pythonanywhere 404错误 [英] pythonanywhere 404 error

查看:119
本文介绍了pythonanywhere 404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用

I'm building an app in pythonanywhere using the Flask Mega Tutorial and it works fine when I run in on my pc. When I upload it to PA it gets a 404 error.

我的结构

/microblog
    /flask (virtualenv setup)
    /app
        __init__.py
        views.py

我的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

我的 init .py文件

from flask import Flask
app = Flask(__name__)
from app import views

我的views.py文件

my views.py file

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--忘记复制初始文件底部的导入内容

--edit-- forgot to copy over the import at the bottom of my init file

推荐答案


project_home = u'/home/thefritobandit/microblog/app
更改为
project_home = u'/home/thefritobandit/microblog

,然后在您的wsgi文件中,将
from __init__ import app as application
更改为
from app import app as application.

这篇关于pythonanywhere 404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆