[英]pythonanywhere 404 error
I'm building an app in pythonanywhere using the Flask Mega Tutorial and it works fine when I run in on my pc. 我正在使用Flask Mega Tutorial在pythonanywhere中构建一个应用程序,当我在我的电脑上运行时它工作正常。 When I upload it to PA it gets a 404 error. 当我将其上传到PA时,会出现404错误。
my structure 我的结构
/microblog
/flask (virtualenv setup)
/app
__init__.py
views.py
my wsgi file 我的wsgi文件
import sys
project_home = u'/home/thefritobandit/microblog/app'
if project_home not in sys.path:
sys.path = [project_home] + sys.path
from __init__ import app as application
my init .py file 我的init .py文件
from flask import Flask
app = Flask(__name__)
from app import views
my views.py file 我的views.py文件
from app import app
@app.route('/')
@app.route('/index')
def index():
return "Hello World!"
I'm sure it's something stupid but any help would be greatly appreciated! 我确定这是愚蠢的,但任何帮助将不胜感激! Thanks! 谢谢!
--edit-- forgot to copy over the import at the bottom of my init file --edit--忘了复制我的init文件底部的导入
change 更改
project_home = u'/home/thefritobandit/microblog/app
to 至
project_home = u'/home/thefritobandit/microblog
and in your wsgi file change 并在您的wsgi文件中更改
from __init__ import app as application
to 至
from app import app as application
. from app import app as application
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.