Questions tagged [urlconf]

116 questions
1
vote
1 answer

Url Not Found Django

So I'm having a bit of trouble. I get a 404 when I try to visit the url for a certain model: url(r'^rewards/(?P[-\w]+)/$', RedeemReward.as_view(), name="reward"), url(r'^rewards/(?P[-\w]+)/$', CompanyDetail.as_view(),…
user3084860
  • 421
  • 5
  • 19
1
vote
2 answers

Can't configure URL in Django

In my views.py I have the following code: from django.http import HttpResponse def index(request): return HttpResponse("Hello, world!") def show_day(request): return HttpResponse("The day is: test123") and in my urls.py in the application…
thomas
  • 1,133
  • 1
  • 12
  • 31
1
vote
0 answers

Django URLs with/without proxy server

I have two Django apps (say, app1 and app2) hosted on the same machine using Apache mod_wsgi. These two apps are hosted on two different environments: On a physical server where only these two apps are hosted. They are accessed as…
Barun
  • 2,542
  • 33
  • 35
1
vote
2 answers

Reverse url in django model help_text

I want to add a link to terms and conditions in help_text property of django model_field, basically I would like to write code like: class UserRegisterData(models.Model): accepted_terms = models.BooleanField( ... …
jb.
  • 23,300
  • 18
  • 98
  • 136
1
vote
1 answer

Django URLconf including: package imports not working

I'm making a simple django site, for which I'm using the django-registration extension. I should probably add that I have just copied the django-registration source to my project as if it was my own app - I'm doing the site with someone else and we…
mz8i
  • 672
  • 1
  • 7
  • 11
1
vote
2 answers

Reload django url's without restarting the server

Why? I want multiple models on the first level of the path :) Using: Django 1.4.1 Code setup urls: PAGE_SLUGS = '|'.join(Page.objects.values_list('slug', flat=True)) BRAND_SLUGS = ... same concept (r'^(?P%s)/$' % BRAND_SLUGS,…
Bas Koopmans
  • 341
  • 4
  • 14
1
vote
3 answers

Django urlconf issue (know there has to be a simple answer)

Hi I am a beginner with django and all I have left to deploy the site is a stupid url conf problem. I have a simple site with 5 pages that are home,contact,about,reasons, and benefits. Simple right, url conf will be (r'^home/$',index), and as…
cj ogbuehi
  • 187
  • 1
  • 10
1
vote
1 answer

Django Urls and App urls with Ajax POST

I've found an issue and tracked it down to url conf. I'm attempting to perform an ajax post to the /gallery/add page which adds a new record into the database. Originally I added a urls.py into my app and then 'include'ed it from the root urls.py…
Richard
  • 2,994
  • 1
  • 19
  • 31
0
votes
1 answer

Django-jchat url include error

This is my urls.py in my main project folder: from django.conf.urls.defaults import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('polls.views', url(r'^$', 'mainindex'), url(r'^about/$',…
Damian Stelucir
  • 55
  • 1
  • 4
  • 9
0
votes
2 answers

Python Django UnboundLocalError while calling a different function

Not long ago I started programming Python with Django. Sometimes I get strange errors and have no clue, why. So, let's beginn with one of these errors. I have a View with two functions. Example: def view_post(request, slug): """ Shows a…
René Stalder
  • 2,536
  • 5
  • 31
  • 50
0
votes
1 answer

Django url pattern with or without as path to view?

I'm new to Django and been reading the http://djangobook.com and finds that the following two patterns work the same way with no hiccups for project named mysite and views.py on the project root with a function named hello. (r'^hello/$',…
mmhan
  • 731
  • 7
  • 18
0
votes
1 answer

How to make this code working django url path

My code is not working, and I am not sure why. I have the problem with hours_ahead function. Here is urlpatterns path('time/plus/(\d{1,2})/', hours_ahead), And I imported hours_ahead too
Mangi
  • 23
  • 6
0
votes
0 answers

Reload all django url's files without restarting server

I need to change my urls in site without reloading server. Using: Django 4.0.2 with open('settings.json', 'r+') as f: data = json.load(f) if data['urls']['posts']["type"] != 'Custom': if data['urls']['posts']["type"] == 'Name': …
Chipnick
  • 43
  • 1
  • 1
  • 6
0
votes
1 answer

Django Custom Template for GenericSitemap

I have a generic sitemap working. I'm now looking to customize the output. Im passing in the custom template_name but it doesn't use it (r'^sitemap/$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps':sitemaps,…
sidarcy
  • 2,958
  • 2
  • 36
  • 37
0
votes
1 answer

Django redirecting to wrong view

I have an app called 'vocab', which so far contains a CreateView and a ListView. In my project urls.py file, I have the following: urlpatterns = [ path('admin/', admin.site.urls), path('',views.HomePage.as_view(),name='home'), …
MeL
  • 1,269
  • 3
  • 12
  • 30