Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Why does FormView (CBV) based view not have a URL parameter in context?
I have a class based view which needs to accept a Form submission. I am trying to auto-populate some of the form fields using the primary key within the URL path (e.g. /main/video/play/135). The class based view is based on FormView, the code I have makes the pk available in context if I use TemplateView, but that is not particularly good for handling forms. urls.py app_name = 'main' urlpatterns = [ #path('', views.index, name='index'), path('video/<int:pk>', views.VideoDetailView.as_view(), name='detail'), path('video/preview/<int:pk>', views.VideoPreview.as_view(), name='preview'), path('player', views.PlayerListView.as_view(), name='player_list'), path('video/play/<int:pk>/', views.VideoPlayView.as_view(), name='play'), path('', views.VideoListView.as_view(), name="video_list") ] Relevant class from views.py: class VideoPlayView(FormView): template_name = "main/video_play.html" form_class = VideoPlayForm initial = {} http_method_names = ['get', 'post'] def get_initial(self, **kwargs): initial = super().get_initial() #initial['video'] = pk initial['watch_date'] = datetime.date.today() return initial def get_context_data(self, **kwargs): kc = kwargs.copy() context = super().get_context_data(**kwargs) video = Video.objects.get(context['pk']) context['video'] = video context['test'] = kc self.initial['video'] = video.pk context['viewers'] = Viewer.objects.all() context['players'] = Player.objects.filter(ready=True) return context def form_valid(self, form): return HttpResponse("Done") I get a key error at the line: video = Video.objects.get(context['pk']) Viewing the debug info on the error page indicates that the context does not have the pk value stored within it. If I change the base class to TemplateView with a FormMixin … -
How to loop through rows and populate columns using data from database in HTML and Django
I am having a problem where the data I am trying to input into a table is not showing properly. I believe my quories are correct since they give out the right information when I test them but when I try to print them to the table they print out wrong. https://imgur.com/a/5u9jQW2 I tried messing around with different for loops, different types of html tags with no luck. {% for students in all_students %} <tr> <th scope="row"> <div class="media-body"> <a href="/student/" class="mb-0 text-sm">{{students.student_name}} </a> </div> </th> {% for date in class_dates %} <td> {% ifequal date.dates attendance.date %} {{students.status}} {% endifequal %} </td> {% endfor %} {% endfor %} ''' It is only printing the dates for april 7th over and over again for all the other dates. Since there is only two students, it seems like its only grabbing one date for each student. Each other date should have their own status. The content the queries print is correct. -
Email from contact form error: Method Not Allowed (POST) 405
I'm creating a Contact page on my portfolio site which when the user fills out and submits will automatically send it as an email to my personal email account. But when I hit Submit I get "Method Not Allowed (POST):/contact/" in my terminal, "HTTP ERROR 405" in my browser and no email in my account. My HTML: <form action="" method="POST"> {% csrf_token %} <div class="row form-group"> <div class="col"> <input name="f-name" type="text" class="form-control" placeholder="First name" required> </div> <div class="col"> <input name="s-name" type="text" class="form-control" placeholder="Last name" required> </div> </div> <div class="form-group"> <input name="email" type="email" class="form-control" id="email-input" aria-describedby="emailHelp" placeholder="name@mail.com" required> <small id="emailHelp" class="form-text text-muted">I Wont Share Your Email!</small> </div> <div class="form-group text-center"> <textarea name="e-message" class="form-control" id="exampleFormControlTextarea1" rows="3" placeholder="your message..." required></textarea> </div> <button type="submit" class="btn btn-primary">Send</button> </form> My views.py: class ContactView(TemplateView): template_name = 'contact.html' def send_message(self, request): if request.method == 'POST': message = request.POST['f-name', 's-name', 'email', 'e-message'] send_mail('Contact Form', message,['email@gmail.com'], fail_silently=False) return render(request, 'thanks.html') My project urls.py from django.contrib import admin from django.urls import path, include from django.contrib.auth import views from blog import views urlpatterns = [ path('admin/', admin.site.urls), path('', include('blog.urls')), path('projects/', views.ProjectView.as_view(), name='projects'), path('blog/', views.BlogView.as_view(), name='blog'), path('contact/', views.ContactView.as_view(), name='contact'), path('thanks/', views.ThanksView.as_view(), name='thanks'), My application urls.py from django.conf.urls import url from blog import views … -
Como solucionar el error raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
estoy desarrollando una single page con el framework Django, al agregar la url de una nueva vista me salto este error. raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) django.core.exceptions.ImproperlyConfigured: The included URLconf '' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import. polls/urls.py from django.urls import path from . import views urlspatterns =[ path('',views.index, name='index'), ] mysite/urls.py from django.contrib import admin from django.urls import include, path urlpatterns = [ path('polls/', include('polls.urls')), path('admin/', admin.site.urls), ] -
Grouping queryset by column value
I have a queryset that returns Tasks by client id from the following models and would like to get some more filters to receive more precised data. Models are just a example structure of what I am trying to achieve: class Client(models.Model): name = models.CharField(max_length=255) def __str__(self): return self.name class Office(models.Model): name = models.CharField(max_length=255) clientid = models.ForeignKey(Client, db_constraint=False, db_index=False, on_delete=models.DO_NOTHING) def __str__(self): return self.name class Area(models.Model): name = models.CharField(max_length=255) officeid = models.ForeignKey(Office, db_constraint=False, db_index=False, on_delete=models.DO_NOTHING) def __str__(self): return self.name class Task(models.Model): name = models.CharField(max_length=255) areaid = models.ForeignKey(Area, db_constraint=False, db_index=False, on_delete=models.DO_NOTHING) The query that I am using: Task.objects.filter(areaid__officeid__clientid='1') It returns long queryset that I need to group by areaid. By grouping I mean receiving for example list of few querysets that contain only Tasks for single areaid. Is there a possibility to achieve this by django orm without looping through queryset I already have? I need this to render different tables in jinja2, unique table for each areaid. -
Adding fields to User model
I am managing to use djangocontrib.auth.models.User. I need to add phone number and profile pic field to the user model. My serializers.py: class UserSerializer(ModelSerializer): password = serializers.CharField(write_only=True) phone_number = serializers.CharField() profile_pic = serializers.ImageField(max_length=None, use_url=True, allow_null=True, required=False) def create(self, validated_data): user = User.objects.create_user( username=validated_data['username'], password=validated_data['password'], first_name=validated_data['first_name'], last_name=validated_data['last_name'], phone_number=validated_data['phone_number'], profile_pic=validated_data['profile_pic'], ) return user class Meta: model = User fields = ('first_name', 'last_name','username', 'password', 'phone_number', 'profile_pic',) But on creating user it returns 'phone_number' is an invalid keyword argument for this function, I need help to create user with phone number and profile. Thanks in advance -
When handling a form POST in a Django views.py, it appears to ignore the HttpResponse type
I have a Django application that generates a table of data. I have a form where you enter parameters and click one button to see the results or another to download a CSV. Seeing the results is working, but downloading the CSV is not. I handle the response in the views.py, set the content type and disposition, and return the response. Rather than downloading the CSV, it displays the data as text. (I tried both StreamingHttpResponse and plain HttpResponse.) The same exact code works when handling a URL passing in the parameters. So, I tried a HttpResponseRedirect instead, and it does nothing. I even tried just redirecting to a plain URL, with no effect. I believe the response type is being ignored, but I don't know why. html: <form action="" method="post" class="form" id="form1"> {{ form.days }} {{ form.bgguserid }} <input type="submit" value="Go!" id="button-blue"/> <input type="submit" name="csv-button" value="CSV" id="csv-button"/> </form> views.py attempt 1: def listgames(request, bgguserid, days=360): if 'csv-button' in request.POST: # create CSV in variable wb response = StreamingHttpResponse(wb, content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="collectionvalue.csv"' return response attempt 2, the same but with: response = HttpResponseRedirect ('/collection/{0}/csv/{1}/'.format(bgguserid,days)) I'm open to other solutions like a client-side redirect to the functioning URL, but … -
Set some views which use Django Rest Framework API
I have a very basic Django Rest API. I don't know how to have some HTML views, in the same django project, which uses API (finally keeping API returning JSON only). I followed this, but it seems to change the API View (in this case, curl will retrieve HTML and not JSON) : https://www.django-rest-framework.org/api-guide/renderers/#templatehtmlrenderer Do I need another Django App ? Another Django project ? Some JS ? -
Request Object Passed to Django-Tables2 Tables Class
Lets say that we have two models: ModelA and ModelB. I will use Django-Tables2 to create a table out of these models. In tables.py you could have two separate table classes (below). from .models import ModelA, ModelB import django_tables2 as tables class ModelATable(tables.Table): class Meta: #some basic parameters model = ModelA #the template we want to use template_name = 'django_tables2/bootstrap.html' class ModelBTable(tables.Table): class Meta: #some basic parameters model = ModelB #the template we want to use template_name = 'django_tables2/bootstrap.html' This means there will be a table for each model. However I think a more efficient coding solution would be to something as follows. class MasterTable(tables.Table, request): #where request is the HTML request letter = request.user.letter class Meta: #getting the correct model by doing some variable formatting temp_model = globals()[f'Model{letter}'] #some basic parameters model = temp_model #the template we want to use template_name = 'django_tables2/bootstrap.html' The issue involves passing the request object in the table definition from views.py. It would look something like: def test_view(request): #table decleration with the request object passed through... table = MasterTable(ModelOutput.objects.all(), request) RequestConfig(request).configure(table) return render(request, 'some_html.html', {'table': table}) I do not know how to pass through a variable, in this case the request object, to the … -
How to get custom user model's custom fields in Django
I've created one custom user model as below class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) bio = models.TextField(max_length=500, blank=True) location = models.CharField(max_length=30, blank=True) birth_date = models.DateField(null=True, blank=True) @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save() Now I want to access that newly added fields(bio, location, birth_date) in my html template. How can I do the same. -
Is it possible to send an parameter in a django url and use it in the javascript on loaded page
Im trying to send a parameter from django url to javascript. I want to do this to make the page more dynamic and load graphs based on this parameter. the javascript in my graph page is calling on an api to populate arrays for the data. I want the parameter to modify my api calls url below path('graphv2/<Currency>', views.graphv2, name='webapp-graphv2'), javascript below I want the parameter to replace currency in the api url var prevHour_endpoint = 'https://min-api.cryptocompare.com/data/histominute?fsym=<Currency>&tsym=EUR&limit=60' var prevHour_defaultData = [] var prevHour_labels =[] var graphData $.ajax({ method: "GET", url: prevHour_endpoint, success: function(data){ graphData = data populateDataHourly() setPrevHourChart() }, error: function(error_data){ console.log("error") console.log(error_data) } }) -
Redirect logged in user in Django 2.2
I need to redirect user if logged in to his home page when he goes to main url. urls.py urlpatterns = [ url(r'^$', LoginView.as_view(template_name='landing.html'), name='landing') ] I tried creating custom view rather than using built in django login. new urls.py urlpatterns = [ url(r'^$', landing_validation, name='landing') ] views.py def landing_validation(request): if request.user.is_authenticated: return HttpResponseRedirect('/user/home') else: return login(request) This works good when user is logged in and tries to enter landing page it redirects him to home page i.e when user tries http://127.0.0.1:8000 it redirects him to http://127.0.0.1:8000/user/home/. But when user logs out i get the error as follows login() missing 1 required positional argument: 'user' I have set urls in settings.py as follows but have never used them: LOGIN_REDIRECT_URL = '/user/home' LOGIN_URL = '/' Any insights on the issue are appreciated. -
Testing API endpoint in DRF - accessing the specific url by name?
I've got a project with the following structure: Project app1 app2 Each app is using django rest framework. My project urls.py file looks like this: import app1.rest_api urlpatterns = [ path('admin/', admin.site.urls), path('app2/', include('app2.urls')), path('app1/', include('app1.urls')), path('api/app1/', include( app1.rest_api.router.urls)), In my rest_api.py file I have the following routes setup: router = routers.DefaultRouter() router.register(r'myspecificmodel', MySpecificModelViewSet, base_name='MySpecificModels') router.register(r'myothermodels', MyOtherModelsViewSet, base_name='MyOtherModels') I have a test_api.py file in the app1/tests directory that looks like this: from rest_framework import status from rest_framework.test import APITestCase, APIClient class URLTest(APITestCase): def setUp(self): self.client = APIClient() def test_url_returns_200(self): url = '/api/app1/myspecificmodels' response = self.client.get(url) # response = self.client.get(url, format='json') self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(len(response.data), 1) This gets me a 301 ResponsePermanentRedirect How would I best go about testing that API endpoint? Is there a way to name the route and test it with reverse as that might be a little easier? -
I tried sorting the list input in views but it is returning List index out of range. What's wrong in the code?
def listform(request): form = LLForm(request.POST) if request.method == 'POST': # If the form has been submitted... if form.is_valid(): # If form input passes initial validation... listll=list(map(int,LinkedList.objects.all()[0].split())) for i in range(1, len(listll)): key = listll[i] j = i-1 while j >= 0 and key < listll[j] : listll[j + 1] = listll[j] j -= 1 listll[j + 1] = key return HttpResponse(listll) else: form = LLForm() return render(request,'basicapp/listform.html',{'form':form}) Where is the list index going out of range? and is there any other way to sort the list that has been input through form. -
Video site using Wagtail
Want to build a video site like YouTube or peer tube but on my lan completely private, basically I want to pretend my kids are online when their not... plus a good project to learn. -
How can I get jwt payload from request object in my view
I'm using django-rest-framework-jwt in my project. I would like to get user_id from the request object in a view. I've tried request.user but it returns AnonymousUser. -
Django M2M Relationship Issue with Admin Using Intermediate Table with Multiselect
I'm working with m2m relationships using through to set intermediate table. Issue is I need to show multiselection instead of a normal dorpdown but when I select multiple items and save I get an error. ValueError: Cannot assign "<QuerySet [<Facility: facility1>, <Facility: facility2>]>": "Property.facility" must be a "Facility" instance. Also I am showing this model in admin.TabularInline which allows me select only one item per row as tabular inline gives capability to insert multiple forms. I have tried multiple solutions like custom save and many other things and some how I get able to save that but then issue appears on view. I need to show only one form with multiselect widget to perform this selection. models.py class Facility(models.Model): name = models.CharField(max_length=200) class Property(models.Model): name = models.CharField(max_length=200) area = models.CharField(max_length=200) facility = models.ManyToManyField(Facility, through="PropertyFacility") class PropertyFacility(models.Model): prop = models.ForeignKey( Property, related_name="facilities", on_delete=models.CASCADE ) facility = models.ForeignKey( Facility, related_name="properties", on_delete=models.CASCADE ) admin.py from django.contrib.admin.widgets import FilteredSelectMultiple from django.utils.translation import ugettext_lazy as _ class PropertyFacilityForm(forms.ModelForm): facility = forms.ModelMultipleChoiceField(Facility.objects.all(), required=True, widget=FilteredSelectMultiple(_('ss'), False, attrs={'rows':'10'}) class PropertyFacilityInline(admin.TabularInline): model = Property.facility.through form = PropertyFacilityForm class PropertyAdmin(TabbedModelAdmin): model = Property tab_facilities = (PropertyFacilityInline,) tab_property = ( ( "Property Details", { "fields": ( "name", "area", ) }, ), … -
How to show children of sub category in Django?
I have the following models: class TutorialCategory(models.Model): category_title = models.CharField(max_length=150) category_summary = models.CharField(max_length=150) category_slug = models.SlugField(default=1, blank=True) class TutorialSeries(models.Model): series_title = models.CharField(max_length=200) series_maincategory = models.ForeignKey( TutorialCategory, default=1, on_delete=models.SET_DEFAULT) series_summary = models.CharField(max_length=200) class Tutorial(models.Model): tutorial_title = models.CharField(max_length=150) tutorial_content = models.TextField() tutorial_published = models.DateTimeField( "date Published", default=datetime.now()) tutorial_series = models.ForeignKey( TutorialSeries, default=1, on_delete=models.SET_DEFAULT) tutorial_slug = models.SlugField(default=1, blank=True) As shown above TutorialCategory is main category, TutorialSeries is sub category and Tutorial is sub-sub-category. I created a simple view that shows sub categories of main categories, but don't know how to show the sub-sub categories of sub category. Please check out views.py and urls.py if you can improve its quality and if there is an easy and better way of doing it. Anyway, this is view: def single_slug(request, single_slug): matching_series = TutorialSeries.objects.filter( series_maincategory__category_slug=single_slug) series_urls = {} for i in matching_series.all(): part_one = Tutorial.objects.filter( tutorial_series__series_title=i.series_title).earliest("tutorial_published") series_urls[i] = part_one.tutorial_slug return render(request, 'tutorial/sub-category.html', context={ "tutorial_series": matching_series, 'part_ones': series_urls }) urls here: urlpatterns = [ path('', views.home_page, name='home'), path('tutorial/<int:id>/', views.tutorial_detail, name='tutorial_detail'), path('<single_slug>/', views.single_slug, name='single_slug'), ] the template that shows sub-category of main category: {% for tut, partone in part_ones.items %} <div class="card"> <div class="card-body"> <h5 class="card-title">{{ tut.series_title }}</h5> <p>{{ tut.series_summary }}</p> <a href="{{ partone }}">Read more</a> </div> </div> … -
Why does Django encouter ModuleNotFoundError in production server (WebFaction) while it can run well with development server?
I'm new to Django and this is a first time I'm trying to deploy my Django application on WebFaction. I searched on StackOverflow but did not find someone who encountered the same problem. My app was developed using Django 2.2 and Python 3.7.3. I have run successfully makemigrations, migrate, collectstatic on my computer's localhost and run successfully those commands when using PuTTY on Windows getting SSH to WebFaction server. However when I restart the WebFaction server and access using browser, it returned ModuleNotFoundError. ModuleNotFoundError at / No module named 'app_www_admission.urls' Request Method: GET Request URL: (my website's URL) Django Version: 2.1.7 Exception Type: ModuleNotFoundError Exception Value: No module named 'app_www_admission.urls' Exception Location: <frozen importlib._bootstrap> in _find_and_load_unlocked, line 965 Python Executable: /usr/local/bin/python3 Python Version: 3.7.3 Python Path: ['/home/marknguyen94/webapps/adm_220_2', '/home/marknguyen94/webapps/adm_220_2/app_www_admission', '/home/marknguyen94/webapps/adm_220_2/lib/python3.7', '/home/marknguyen94/webapps/adm_220_2/lib/python3.7/Django-2.1.7-py3.7.egg', '/home/marknguyen94/webapps/adm_220_2/lib/python3.7/pytz-2019.1-py3.7.egg', '/home/marknguyen94/lib/python3.7', '/usr/local/lib/python37.zip', '/usr/local/lib/python3.7', '/usr/local/lib/python3.7/lib-dynload', '/home/marknguyen94/.local/lib/python3.7/site-packages', '/usr/local/lib/python3.7/site-packages'] Server time: Wed, 24 Apr 2019 10:48:37 +0000 I tried resolving the package that I imported in these files: admin.py, forms.py, models.py, settings.py, main urls.py, the app's urls.py, views.py and I realized that: For development, I must import using: from app_www_admission.models import ... For production, when I restart the Webfaction server, I must import using: from app_www_admission.app_www_admission.models import ... The option (1) lets … -
Not able to make ajax request when uses IP address instead of localhost
I developed Django based web application in my company which I was able to access at localhost: http://127.0.0.1:8000/olx and made the ajax request without fail. When I accessed the same on my computer's IP address: http://10.0.100.148:8000/olx , all things were working except ajax reuquest. I got the following error message: 403 forbidden Later I did the same thing in my personal laptop at my home and saw that I was able to access ajax request as well in both the cases: localhost and my laptop's IP address: http://192.168.1.8:8000/olx , which was connected to a wifi network. I also accessed the application in my mobile,connected to the same wifi-network, by typing the laptop's IP address and it was working fine. Now I am in confusion that why I was not able to make the ajax request at the IP address of my company's computer. What went wrong. Can somebody help me to understand the reason behind this? -
null value in column after migration on different git branch
My model: class Item(models.Model): name = models.CharField(...) description = models.CharField(...) I run manage.py makemigrations and manage.py migrate Then I switched to another git branch where description field doesn't exist yet but when I try to create new Item object I see: null value in column "description" violates not-null constrain What is the best way to fix that? -
Model not defined in django
I'm trying to add a new form to my Django project, but i keep getting this error: model = SomeModel NameError: name 'SomeModel' is not defined I don't get why, since i defined SomeModel in my models file. Here is my code: class TestForm(ModelForm): data = forms.CharField(label='Data', max_length=100) class Meta: model = SomeModel fields = ("test",) def save(self, commit=True): send = super(TestForm, self).save(commit=False) send.data = self.cleaned_data['Data'] if commit: send.save() return send And here is my model: class SomeModel(models.Model): data = forms.CharField(max_length=100) def save(self): # ALL the signature super(SomeModel, self).save(using='dataset') What am i doing wrong? Am i not declaring my model properly? Thanks in advance! -
confusion to create rest API using django
This is my collage project. i want to create a web services using django but i don't know about Rest API. i read more document on rest API, but i am confuse how to apply on my web app. please help me out. thank you. This is my view.py file. from .forms import ReadFileForm from django.shortcuts import render import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from io import BytesIO import base64 from matplotlib import style style.use('ggplot') from scipy import interpolate, signal def upload1(request): form = ReadFileForm() if request.method == 'POST': form = ReadFileForm(request.POST, request.FILES) if form.is_valid(): file = request.FILES['file'] ascii_data = np.loadtxt(file) data_m_sec = ascii_data data = {} data["RR"] = np.array(data_m_sec) data["BeatTime"] = np.cumsum(data["RR"]) / 1000.0 data["niHR"] = 60.0 / (data["RR"] / 1000.0) data["interpfreq"] = 4.0 xmin = data["BeatTime"][0] xmax = data["BeatTime"][-1] step = 1.0 / data["interpfreq"] tck = interpolate.interp1d(data["BeatTime"], data["niHR"]) xnew = np.arange(xmin, xmax, step) data["HR"] = tck(xnew) info = {} info["beats"] = "{0:.2f}".format((len(data["BeatTime"]))) info["minhr"] = "{0:.2f}".format(min(data["niHR"])) info["maxhr"] = "{0:.2f}".format(max(data["niHR"])) info["meanhr"] = "{0:.2f} bps".format(np.mean(data["niHR"])) info["meanrr"] = "{0:.2f} msec.".format(np.mean(data["RR"])) info["stdhr"] = "{0:.2f} bps".format(np.std(data["niHR"], ddof=1)) info["stdrr"] = "{0:.2f} msec.".format(np.std(data["RR"], ddof=1)) # for RR Histogram fig1 = plt.figure(1) axes = fig1.add_subplot(1, 1, 1) axes.hist(data["RR"], 30, density=1, facecolor="red") axes.set_xlabel("RR … -
Domain name with local network with Django
I want test my Django application in local network (wireless). My application is served by a notebook that is connect via ethernet to the router. I already edit (windows 10) hosts file by adding something like this: 127.0.0.1 mytest.com 192.168.1.8 mytest.com 0.0.0.0 mytest.com I start the django server with one of three ip above with runserver 192.168.1.8:8000 and clearly I add in settings file the ALLOWED_HOSTS = ['127.0.0.1', '192.168.1.8', 'mytest.com', '0.0.0.0'] the result is that with the notebook I can write in the browser one of the allowed host and I can see the application. If I try to use a smartphone indeed i'm able to view the application only if I type 192.168.1.8:8000. My goal is to digit on the mobile browser mytest.com:8000 and see the application. I use a DHCP configuration but of course I can manually set static ip if I want. -
Page not found (404) error on company code that I just cloned and should work. Is there anything wrong with the code?
A coworker and I are getting the same issue when we clone the Central Desk website from our repository. It is giving us the Page not found (404) error and we don't know why. The code should work fine, considering its the code for our website. I've tried it connected to our VPN and unconnected, I've restarted the clone process and redone everything and I still get the error. I've tried making Redis in protected mode and out and nothing work. I've looked at our urls.py file and the settings_development.py file and they both look okay. from django.conf.urls import include, url from django.views.generic import RedirectView from django.core.urlresolvers import reverse_lazy from django.contrib.auth.views import logout_then_login from heart.views import DashBoard, get_names from heart.forms import LoginForm from heart.login import login_set_desk # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns =[ # Examples: # url(r'^apps/central_desk/$', 'centraldesk.views.home', name='home'), # url(r'^apps/central_desk/centraldesk/', include('centraldesk.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^apps/central_desk/admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^apps/centraldesk/helm/', include(admin.site.urls)), url(r'^apps/centraldesk/heart/', include('heart.urls')), url(r'^apps/centraldesk/items/', include('item_tracker.urls')), url(r'^apps/centraldesk/lost_and_found/', include('lost_and_found.urls')), url(r'^apps/centraldesk/mail/', include('mail.urls')), url(r'^apps/centraldesk/login/$', login_set_desk, name="login"), url(r'^apps/centraldesk/dashboard/$', DashBoard.as_view(), name="dashboard"), url(r'^apps/centraldesk/logout/$', logout_then_login, name="logout"), url(r'^apps/centraldesk/forum/', include('forums.urls', namespace='forums')), url(r'^apps/centraldesk/comm/', include('comm_log.urls')), url(r'^apps/centraldesk/checkin/', include('checkin.urls')), …