Django wsgi.py Http 404错误

时间:2016-09-10 15:10:26

标签: python django wsgi controllers

我是Django的新手,目前正在将它用于我公司的应用程序。 我使用wsgi开始(API需要)。 index.html能够加载js和css文件,但是当点击html上的'Run'时,它会给出错误代码404.

- > GET / CurrentTime HTTP / 1.1 404

在App.py中:

from App import wsgi
app = wsgi.application

在wsgi.py中:

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'App.settings'

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
在urls.py中

urlpatterns = [
    url(r'^CurrentTime$', TestControllers.get_current_time),

...

在TestControllers.py

def get_current_time(req):
    return HttpResponse(datetime.now().strftime("%a, %d %B %Y %I:%M:%S%p"))

有人可以帮忙吗?欣赏它。

0 个答案:

没有答案