BlazingIce
Help with cron job in flask and postgres
My /api directory is:
/api
|-- models.py
|-- app.py
|-- config.py
|-- cron.py
I want to run a backend server and a cron service seperately. Backend builds and works. cron.py imports from models and config. How can I create a service that only runs cron.py? Is it something with railway.toml?
23 replies
Gunicorn failed to deploy after building (new to railway)
Changed from api import app, db to many others like from . import app, db, not sure if this is the problem.
Procfile:
web: gunicorn app:app
[2024-01-18 06:18:33 +0000] [7] [INFO] Starting gunicorn 21.2.0
[2024-01-18 06:18:33 +0000] [7] [INFO] Listening at: http://0.0.0.0:7634 (7)
[2024-01-18 06:18:33 +0000] [7] [INFO] Using worker: sync
[2024-01-18 06:18:33 +0000] [11] [INFO] Booting worker with pid: 11
[2024-01-18 06:18:33 +0000] [11] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
worker.init_process()
File "/opt/venv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 134, in init_process
self.load_wsgi()
File "/opt/venv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
self.wsgi = self.app.wsgi()
File "/opt/venv/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/opt/venv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
return self.load_wsgiapp()
File "/opt/venv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
return util.import_app(self.app_uri)
.
.
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/app.py", line 8, in <module>
from api import app, db
ModuleNotFoundError: No module named 'api'
46 replies