0

这是我收到的错误:

14:56:03 web.1  | ImportError: No module named apps.careers

我的主要 urlconf 如下所示:

from django.conf.urls import patterns, include, url

from pinpoint.views import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', home.as_view(), name='home'),
    url(r'^home/', home.as_view(), name='home'),

    #Top Menu
    url(r'^solutions/', solutions.as_view(), name='solutions'),
    url(r'^about/', about.as_view(), name='about'),
    url(r'^contact/', contact.as_view(), name='contact'),

    #Footer
    #url(r'^careers/', include('pinpoint.apps.careers.urls')),
    url(r'^privacy/', privacy.as_view(), name='privacy'),

]

我的 apps.careers.urls 看起来像这样:

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



urlpatterns = patterns('',

    url(r'^apply/$', 'pinpoint.careers.views.careers'),

)

我的 apps.careers.views 看起来像这样:

    #forms imports
from pinpoint.apps.careers.forms import applicantsForm

#models imports
from pinpoint.apps.careers.models import applicantsModel

def careers(request):
    errors = []
    if request.method == 'POST':
        form = applicantsForm(request.POST)
        if form.is_valid():
            clean_form =form.cleaned_data
            collect = applicantsModel(first_name=clean_form['first_name'], last_name=clean_form['last_name'],
                linkedin_profile=clean_form['linkedin_profile'], elevator_pitch=clean_form['elevator_pitch'],
                email=clean_form['email'], phone=clean_form['phone']) #dont't need the created field
            collect.save()
            return HttpResponseRedirect('/careers/apply') #the same page, change to thankyou page later
        else:
            #say whats not valid and return it
            if not request.POST.get('first_name', ''):
                errors.append('Enter a First Name.')
            if not request.POST.get('last_name', ''):
                errors.append('Enter a Last Name.')
            if not request.POST.get('linkedin_profile', ''):
                errors.append('Enter a LinkedIn Profile.')
            if not request.POST.get('elevator_pitch', ''):
                errors.append('Enter an Elevator Pitch.')
            if not request.POST.get('email', ''):
                errors.append('Enter an Email.')
            if not request.POST.get('phone', ''):
                errors.append('Enter a Phone Number.')

            return render(request, 'careers.html', {'errors':errors})

    else:
        return render(request, 'careers.html',)

我在 virtualenv 中使用 django 1.6。我无法弄清楚这里的问题是什么。我可以根据要求提供更多信息。

编辑: 这是我目录的图片 - https://app.box.com/s/iva9hkqby1ycqpz0zci5

4

0 回答 0