Django ViewDoesNotExist at /无法导入错误

时间:2013-12-09 22:22:59

标签: django

我在生产服务器上的Django应用程序出错了(开发服务器工作正常) ViewDoesNotExist at / facebookLogin / 无法导入userinfo.views.newUniversity。模块userinfo.views中不存在视图。

我做了一些阅读,看起来这通常源于循环进口。我检查了我的进口,我认为没有任何循环:

userinfo.views:

import json
import datetime
import random, urlparse, urllib, urllib2
from userinfo.models import UserInfo, University, LoginForm, UniversityForm, Organization, PotentialManager
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import get_object_or_404, render_to_response, HttpResponse, redirect
from django.core.mail import send_mail
from django.template import Context, loader, RequestContext
from django.contrib.auth.models import User

events.views:

import datetime
from django.utils import timezone
from django.shortcuts import get_object_or_404, render_to_response, HttpResponse, redirect
from django.template import Context, loader, RequestContext
from events.models import Event, EventForm, Caterer, CommentForm, Advertisement, Comment
from userinfo.models import UserInfo, University, Organization
from django.contrib.auth.models import User
from django.core.mail import send_mail
from events.profinities import containsProfinities
from random import randint

但这对我来说非常好奇,因为如果我遇到任何return redirect('/whatever/')时遇到这个问题。但是,如果我将其更改为from app.views import whatever& return whatever(request)它解决了这个问题。但在我的facebookLogin代码中,我需要调用重定向。

此外,我的网站已经工作了几个月。这个问题直到我没有碰过服务器的最后几天才显现出来。莫名其妙。

另一个奇怪的事情是我完全取出了NewUniversity模块。它甚至都不在我的项目中了。我不知道它为什么还在尝试导入它。我很困惑

urls.py:

from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    url(r'^admin/', include(admin.site.urls)),
    url(r'^facebookLogin', 'userinfo.views.facebookLogin', name='facebook login'),
    url(r'^selectUniversity/', 'userinfo.views.selectUniversity', name='select university'),
    url(r'^loginView/', 'userinfo.views.loginView', name='login'),
    url(r'^editProfile/', 'userinfo.views.editProfile', name='login'),
    url(r'^guestLogin/', 'userinfo.views.guestLogin', name='guest login'),
    url(r'^events/', 'events.views.eventList', name='event list'),
    url(r'^logout/', 'userinfo.views.logoutView', name='logout'),
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT}),
    url(r'^(?P<school>.*)/', 'events.views.schoolEvents', name='events'),
    url(r'^$', 'events.views.eventList', name='home'),
)

0 个答案:

没有答案