Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a file manage.py,

import os
from app import create_app
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
if __name__ == '__main__':
    app.run()

manage.py is working fine when tested in debug mode. However, I'm not able to host it on apache.

my wsgi file: start.wsgi

from manage import app as application
import sys
sys.stdout = sys.stderr

virtual host:

<VirtualHost *:80>
   ServerName domain.com
   WSGIDaemonProcess manage user=user group=user threads=5
   WSGIScriptAlias / /var/www/apioflifeapp/app/start.wsgi
   <Directory /var/www/apioflifeapp/app>
        Require all granted
        Options all
        AllowOverride all
        Allow from all
   </Directory>
</VirtualHost>

error in error log

 [Sat Feb 21 10:55:47.329450 2015] [:error] [pid 25422] [client 197.226.128.204:56062]   File "/var/www/apioflifeapp/app/start.wsgi", line 1, in <module>
    [Sat Feb 21 10:55:47.329601 2015] [:error] [pid 25422] [client 197.226.128.204:56062]     from manage import app as application
    [Sat Feb 21 10:55:47.329624 2015] [:error] [pid 25422] [client 197.226.128.204:56062] ImportError: No module named manage

i'm not understanding why i'm getting the import error

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
206 views
Welcome To Ask or Share your Answers For Others

1 Answer

You need to import the app name from your actual application, not manage. Assuming it's apioflifeapp, you would import the following in start.wsgi instead:

from apioflifeapp import app as application

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...