Ich möchte in einem Schritt durch eine Hello-World Flask App unter Gunicorn mit PyCharm CE laufen.Debuggen einer Flask-App unter Gunicorn mit PyCharm
Die App ist die übliche 5-10 Liner sitzt in /tmp/hello-world/app
, und das Ventil ist in /tmp/env
.
Meine PyCharm Konfiguration sieht wie folgt aus:
Script: /tmp/env/bin/gunicorn
Script parameters: /tmp/hello-world/app:app
Working directory: /tmp/hello-world
Die App läuft gut von der Kommandozeile in diesem Venv gunicorn app:app
verwenden, aber wenn ich den Server unter PyCharm CE starten, ein Import intern gunicorn fehlschlägt:
Traceback (most recent call last):
File "/tmp/env/lib/python2.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/tmp/env/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/tmp/env/lib/python2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/tmp/env/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/tmp/env/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/tmp/env/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/tmp/env/lib/python2.7/site-packages/gunicorn/util.py", line 352, in import_app
__import__(module)
ImportError: Import by filename is not supported.
Lösungen, die nicht funktionieren:
- ich sehe 012 nichtauf macOS und PyCharm CE 2016.3. Ist diese Antwort nach fast vier Jahren relevant?