2015-07-13 64 views
0

Im試圖在Pythonanywhere上部署我的應用程序。當我進口下列Django類,它不會承認他們(它在我的本地服務器上的偉大工程):urls.py在Pythonanywhere中不工作

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 : 

我的問題是:我需要加載任何配置的東西,以使他們的工作?

+2

也許[此問題](https://github.com/omab/python-social-auth/issues/269)是相關的?它看起來像[this](http://stackoverflow.com/questions/17255561/attributeerror-regexurlresolver-object-has-no-attribute-urlconf-module)其他問題沒有答案... – Bakuriu

回答

2

您使用的是Django的錯誤版本。該代碼被評論爲Django 1.8,但例外來自安裝在PythonAnywhere for Python 3.3和1.6.6版本中的內置Django。

+0

謝謝!我如何在PythonAnywhere中升級到Django 1.8? –

+0

PythonAnywhere幫助頁面中有關於爲您的web應用使用virtualenvs的文檔。 – Glenn