Questions tagged [django-urls]
The Django URL dispatch system
3,766
questions
0
votes
0
answers
22
views
Django: messages.error doesn't work with redirect('/')
I'm so confused in templates main page I have:
{% for message in messages %}
{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}
<div class=&...
-2
votes
0
answers
18
views
How do i resolve django staff and student dashboard work
Please fellow programmers, can someone help me write a Django staff and student dashboard where registered students who are attached to a particular staff can receive YouTube video uploads from their ...
1
vote
1
answer
35
views
How to pass optional parameters to a view in Django?
I have a view that takes two optional keyword arguments: team and year_month
def monthly_data_list(request, year_month:str=None, team=None):
From the template, I want to call different combinations ...
0
votes
1
answer
79
views
Server Error (500) on django app production
Updated, Please check the updated part.
I am trying to deploy a Django Application on Render.
In my project, I have some number of apps that have their own urls.py file. Then, in the project's url, I ...
0
votes
1
answer
42
views
Reusing queryset within a view that is called multiple times?
I have a view that is part of a page, I am using HTMX to update this view multiple times (each time is a new question, the user answers, then the next question is shown). The rest of the page does NOT ...
0
votes
0
answers
44
views
Using Django Allauth without allauth urls?
I want to use django allauth package without its built in urlpatterns. Main reason for that is that I want to have the ulrs in different language. Also I dont want to have the allauth url available ...
0
votes
1
answer
11
views
hyperlink leads to 404 error message, No Post matches the given query, Expecting to lead to `views.PostList.as_view()`
Expecting hyperlink in index.html to lead to views.PostList.as_view()
hyperlink located in templates/base.html line 46:
<a class="nav-link" href="{% url 'questions' %}">Top ...
0
votes
1
answer
16
views
Django NoReverseMatch Error for 'questions' View After Google OAuth Sign-In
I'm working on a Django project with Google OAuth implemented. The homepage (index.html) loads correctly, and the Google OAuth sign-in functions as expected. However, I'm encountering a NoReverseMatch ...
0
votes
2
answers
32
views
Is it possible to combine a regex url pattern with url converter
I have two different paths in django-project urls
re_path(internal_site_url, internal_site), #for internal sites #internal_site_url is re_pattern
path('<path:site_url>', external_site) #for ...
0
votes
0
answers
24
views
Mapping a view from an App directory to a URLS.py file in the project Directory for Django
On Django using VS as the Editor, I have 2 directories in the root folder. A Project Directory named Hell and an App Directory named Rango. I have already defined the Rango app Directory in the ...
0
votes
0
answers
17
views
installing a django_url_alias module
I have a requirement of creating a external URI which is different from internal URI. External URI will be configured/created by Website user and Internal URI will be created on the fly by Application ...
3
votes
2
answers
77
views
Djang views and urls connect
App folder views.py:
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def MyApp(request):
return HttpResponse("HELLO APP")
App folder ...
0
votes
1
answer
27
views
NoReverseMatch Django - Attribute printing elsewhere in file?
I am getting a 'No reverse match' error in my Django DeleteView template. I have done some research, and this is supposedly caused when an attribute for a url redirect is blank.
The error looks like ...
1
vote
1
answer
35
views
Cannot access django-admin panel on port
Expecting to be able to access django admin panel and add social accouunt
opening admin panel by adding standard admin/ extension to local preview port URL. This is expected to lead to classic django ...
0
votes
0
answers
26
views
In Django, how to remove language prefix conditionnally after internationalization ? Media file src problem
In a django project, after a query I'm sending image srcs to a JS file that will then create popovers dynamically on my home page using these image srcs and some text data.
ex : popover_photo.src = '...
2
votes
1
answer
30
views
Is it possible to make Django urlpatterns from a string?
I have a list of strings that is used to define navigation pane in a Django layout template. I want to use the same list for view function names and use a loop to define urlpatterns in urls.py ...
0
votes
1
answer
37
views
getting model object using .get(slug=slug) return an error: Invitation matching query does not exist
I am creating a notification system using django, I'm using django signal to create Notification model when the Invitation model is created, but when I created the Invitation model, and click on the ...
0
votes
0
answers
11
views
How to Add 'rest_registration' URLs to Default Routers in Django REST Framework and Include Them in API Root?
I am using the 'rest_registration' package to handle user validation and registration in my Django REST API project. I would like to integrate the 'rest_registration' URLs with the default routers in ...
0
votes
1
answer
53
views
How to fix in django "Page not found (404)" error ("Django tried these URL patterns... The empty path didn't match any of these.")
As a newbie to Django, I encountered the same problem as many before me. I would appreciate if you didn't mark my question as a double immediately because I checked the fixes those old posts suggested ...
0
votes
1
answer
32
views
Reverse for 'posts-details-page' with arguments '('',)' not found. 1 pattern(s) tried: ['all_posts/(?P<slug>[-a-zA-Z0-9_]+)$']
I have build the basic Django project but getting error while trying to retrive all the post from the project. you can download the code from github to create the issue, Please guide me how to resolve ...
-1
votes
1
answer
88
views
why is Django not correctly routing my urls?
I am trying to put together a simple website with django. I have my routes defined and they work provided that if i want to go to home i have to localhost/home/home rather than just it being localhost/...
1
vote
1
answer
23
views
NoReverseMatch at /reset-password-confirm/
Im trying to implement Reset Password View by using View class.
Actually I faced with an error that is annoying.
I have 3 Views for implementing:
UserResetPasswordView Here User enters email and a ...
0
votes
1
answer
26
views
how to render URL patterns in Django with multiple apps
I am trying to build a booking system, using Django. I have multiple apps and rendering the urls patterns has been difficult to understand and i have found the documentation little help when you have ...
0
votes
1
answer
32
views
Only default home page is working when deploying in PythonAnywhere
error message
I deployed my Django webapp in PythonAnywhere. Despite following every step, my webapp is displaying only 1 page. As soon as i click on a link to go to other pages, the webapp stops ...
2
votes
1
answer
41
views
NoReverseMatch on Django URL when more than one present
I have a table with a list of data values on it. One of the columns contains a link to another page. Sometimes there could be one link, sometimes two and sometimes n.
When there is only one link ...
0
votes
2
answers
21
views
Please how to solve NoReverseMatch
Reverse for student_detail with keyword arguments {'student_id': 'STUD/1/230922'} not found.
1 pattern(s) tried: ['students/STUD/(?P<student_id>[0-9]+)/(?P<current_date>[0-9]+)/\\Z']
this ...
0
votes
1
answer
22
views
Django HttpResponseRedirect() doesn't work - it doesn't redirect to the page
I was trying to implement the function listing(request, listId) that when user wants to post a comment without login, it will be redirected to the login page.
This is the code of my listing(request, ...
0
votes
1
answer
34
views
After successful login django giving 404 error
I have a login page, and after user logs in it should take him to the main page under articles.
I have the main project called pnb, then i have 2 other apps, which are users and articles
Under the pnb ...
0
votes
1
answer
37
views
Django admin page showing PATH module not found
I am trying to access:
http://127.0.0.1:8000/admin/login/?next=/admin/
but I am shown with this error:
'''
ModuleNotFoundError at /admin/login/
No module named 'path'
Request Method: GET
Request URL: ...
0
votes
0
answers
18
views
Using prefix_default_language=False disable javascript translations
I have implemented javascript translations, following exactly the documentation.
It works perfectly when I use prefix_default_language=True in my i18n_patterns fonction.
But when ...
1
vote
1
answer
25
views
Phython getting issue with urls path
I'm learning pyhton django, and I created a file nosotros.html inside of templates/paginas:
and on views.py my I have:
from django.shortcuts import render
from django.http import HttpResponse
# ...
0
votes
0
answers
23
views
Why is running django app in cmd giving me a module error?
each time I try to run my django app it is giving me this error( ModuleNotFoundError: No module named 'django.contrib.genresdjango')
The genres is the page iam trying to create
I tried removing the ...
0
votes
0
answers
34
views
How to resolve in django AttributeError: module 'learning_logs.views' has no attribute 'new_entry'
This is my views.py:
from django.shortcuts import render, redirect
# Create your views here.
from .models import Topic
from .forms import TopicForm, EntryForm
def index(request):
""&...
0
votes
1
answer
46
views
understanding of urlpatterns in urls.py of Django App
Problem: When we try to add the data to the database. So, the request will always come to this URL starting with the project-level directory, todo_main. So here, we will create a pattern.
path('todo/',...
0
votes
1
answer
30
views
Why am I getting Post method error while submitting form in Django?
This is the error which i m getting when trying to click on the submit button:
Page not found (404)
Request Method: POST
Request URL: http://127.0.0.1:8000/contact/
Using the URLconf defined in ...
1
vote
1
answer
45
views
Trying to send Validation Email in django, getting error
Im trying to send validation email when creating a user in django. It used to work like that but then I did some refactoring on the URLs and used urlpattern = UrlPattern() and urlpattern.register(...
0
votes
0
answers
44
views
Index page from React Router Dom not showing in Django
I have 2 different apps Landing and Main. Both use react build files as templates and static files to render information on the web page. This works fine for the Landing app but not the Main app, ...
0
votes
0
answers
26
views
Django url in a tag doesnt work because it adds new parameters to the url and doesnt remove unnecessary ones
I googled a lot, but I guess I use the wrong keywords to find the solution:
I have this urls.py file:
path('site1', views.site1, name='site1'),
path('site2/<slug:topic>', views.site2, name='...
0
votes
0
answers
48
views
How to resolve "django.urls.exceptions.NoReverseMatch: Reverse for 'activate' not found."
I'm currently working on a local project using Django 4.2 as backend. I'm trying to do account activation based on email. Below is my code snippet.
Project urls.py
from django.contrib import admin
...
-1
votes
1
answer
130
views
Registering custom path converters in django
I am learning Django custom path converter and its registration while I understand all the string integer sledge and uuid Types of url modifications but while registering a custom path converter I ...
1
vote
0
answers
32
views
django.urls.exceptions.NoReverseMatch: Reverse for 'login' not found. 'login' is not a valid view function or pattern name
I got the error:
django.urls.exceptions.NoReverseMatch: Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
When write:
https://chalets.com:8000/accounts/login in URL. ...
-1
votes
1
answer
25
views
artichels_pagination.get() missing 1 required positional argument: 'request'
class artichels_pagination(ListView):
queryset =models.article.objects.all().order_by('-upload')
template_name = 'blog.html'
def get(self,request):
page_artichel = Paginator(self....
0
votes
1
answer
23
views
Why am I getting the "is not a registered namespace" error?
My project was working fine before I added get_absolute_url, but after adding it, when I make a request to the main page, it gives the get_absolute_url error.
I don't know what parts of my project to ...
0
votes
0
answers
19
views
Cpanel deployment of Django project getting 404 Not Found Error when entering any path besides just the domain
For the sake of the question, the domain of my site is domainname.com
Typing in the domain into the web gets a functional page with loaded html and css. However, when I click on a button on the site, ...
0
votes
1
answer
52
views
Django - what happens when re_path finds a match but hands off to an "include"d urls.py file?
I'm working on a Django site, but fairly new to Django and Python.
I have a situation where there is a "higher level" urls.py file using re_path to do regex matching for subdirectories, and ...
-1
votes
1
answer
20
views
Why does this error Django throw the error cannot resolve keyword slug
I have been trying to build a students learning platform but am having some real issues using slug in Django to create readable urls but i have encountered this error
Cannot resolve keyword 'slug' ...
0
votes
1
answer
38
views
No Reverse match after using slug
I have been trying to adopt slugs in Django project to give beautiful urls since i have more than one app in the Django project but I have encountered this error. Am stuck and I do not know to sort it ...
0
votes
0
answers
111
views
Adding multiple HTML pages in Django efficiently
I have created a simple Django application which features a single HTML page for each US state. Each state page extend base.html but features different content.
URLs are stated in the URLs.py file and ...
0
votes
0
answers
10
views
does anyone know how to perform stepwise regression in django app
I am developing a Django app where in the user will upload a .csv file or excel file by clicking a file upload option and also will have to choose between 4 options 1. stepwise regression 2. LASSO 3....
0
votes
1
answer
18
views
Registration system not working in Django
Hello, I have created a user registration system, but when I fill in the information on the registration page and click on registration, no user is created and only the same form is displayed on the ...