我正试图在Pythonanywhere
上部署我的应用。当我导入以下Django
类时,它将无法识别它们(它在我的本地服务器上运行良好):
from django.conf.urls import include, url
from django.contrib import admin
来自urls.py的:
"""general URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from adray import views
urlpatterns = [
url(r'^$', views.index, name='home'),
url(r'^happen/$', views.happen , name='happen'),
url(r'^simulate/$', views.simulate , name='simulate'),
url(r'^run/$', views.happen , name='run'),
url(r'^existing/$', views.existing , name='existing'),
# url(r'^inspired/$', views.inspired , name='inspired'),
]
error.log中:
2015-07-13 04:28:26,107 :Traceback (most recent call last):
2015-07-13 04:28:26,107 : File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 358, in urlconf_module
2015-07-13 04:28:26,107 : return self._urlconf_module
2015-07-13 04:28:26,107 :AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'
2015-07-13 04:28:26,108 :
我的问题是:我是否需要加载任何配置某些东西以使它们起作用?
答案 0 :(得分:3)
你使用的是错误的Django版本。该代码被注释为Django 1.8,但异常来自内置的Django,它安装在PythonAnywhere for Python 3.3和版本1.6.6上。