425 questions
2
votes
1
answer
35
views
Is it OK use multiple empty routes in Django URL patterns?
One of my project's app's url.py includes url files from other apps. Is there any issue I'm overlooking by including them with empty routes? e.g.:
In appA urls.py:
urlpatterns = [
path('hub/', ...
0
votes
0
answers
19
views
Django: Facing Issues in accessing DB and Instantiating object on app load
I want to load data from db and store it in an object and access that object from anywhere in the Django project.
Preferably using the conventional settings.GlobalSettings where settings are the ...
0
votes
0
answers
110
views
How to convert my Django project to an exe file?
I have done a project using Django which has four Django apps. I am trying to distribute my project to someone as a standalone executable file. I am using PyInstaller for that. But, it detects only ...
0
votes
0
answers
218
views
Django project deployment on Vercel got me an error
I have created a simple blog application using django and postgres database. While I wants to deploy to vercel it throws a different errors like this
error
error
How can i solve this error?
...
0
votes
0
answers
34
views
Using pytest to test django packages
I have created a Django package (a Django App) that adds functionality to Django when installed and referenced in settings.py INSTALLED_APPS of the Django project.
I am familiar with writing tests for ...
2
votes
2
answers
75
views
Django Test: how to simulate LookupError for django_apps.get_model()
I need help to implement a test for my Django app.
This is a snippet code from my serializer, that I want to test:
try:
app_config = django_apps.get_app_config(BcConfig.name)
...
-1
votes
2
answers
560
views
PyLint Django: django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured
My Django app works fine when I am just launching my application through python src/manage.py runserver But I would like to integrate pylint here, and when i launch the command pylint src --load-...
1
vote
0
answers
51
views
Proxy model edit/add missing on Foreign Key fields?
Goal:
I want to group some of my models inside of other apps on the Admin page.
How:
I created a proxy model for each of my models and defined app_label to be that of the app I want.
class ...
1
vote
1
answer
47
views
Larger Django project with mulptiple levels of subfolders with 20 apps
I am working on larger Django project which needs multiple levels of subfolders, for example applications/examples/example_1 where the app is.
When adding this app to settings.py
INSTALLED_APPS = [
...
0
votes
1
answer
55
views
How can I access templates from an imported Django application?
I want to pip install a Django application and be able to access its templates when adding it to the "INSTALLED_APPS" section in Django project's "settings.py" file.
I followed the ...
-1
votes
1
answer
100
views
Django how to change CSS according the app you are in
I am pretty new with Django, I am customizing my admin section and I'd like to change the CSS according to the app I am browsing.
Is it possible?
I noticed that the uploaded CSS is the one in the ...
0
votes
1
answer
176
views
Can I run a bot inside a Django project that will run independently of other Django apps?
I have a Django project for a website. And for the same website, I run another Python bot to scrap some data. I was wondering if I could somehow attach the bot to the Django project so that both can ...
0
votes
1
answer
162
views
Error message for deploying Django app to Azure
Is anyone able to explain why I'm getting this error message when trying to deploy my django-python app to Azure via the VS Code Azure Tool Extension?
"This region has quota of 0 instances for ...
0
votes
1
answer
66
views
Can I give parameters to AppConfig.ready() of django?
I want to get request.user.id as I have to pass it to scheduler in AppConfig.ready() but it gave an error. How can I do it ?
My code is as follows:
class ApiConfig(AppConfig):
name = 'myapp'
...
0
votes
2
answers
128
views
Can't satisfy Django configuration for AUTH_USER_MODEL setting
I use Django Rest Framework and have a AbstractUser that I have inherited to create my user :
file : Project/NovalixExpedition/models/NovalixUserModel
from NovalixBackend.models.AddressModel import ...
-1
votes
2
answers
59
views
linking apps in Django, which is better, urls.py or app.py?
Going through some tutorials as a beginner in Django, I noticed a tutor linked the various apps in the urls.py and another tutor did it with the app.py using the config function
just looking for ...
0
votes
1
answer
1k
views
Problem with INSTALLED_APPS in django settings.py file
If I try to add blog.apps.BlogConfig string to INSTALLED_APPS (to define the blog app), local server won't start giving me an error. Photos attached below:
I am expecting for the separate section to ...
0
votes
1
answer
645
views
Azure 'Application error' when trying to run Django Web App
Trying to host my Django app on Azure however I received the following errors. I also have an sqlite database but I dont think that causes the error if I'm not mistaken. I have set the DOCKER_REGISTRY....
1
vote
0
answers
203
views
django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
I am troubleshooting an NGINX/Django/UWSGI application for a customer, that has been broken beyond expectations. I've been debugging code, and re-writing for 30+ hours now and am at another hurdle ...
0
votes
2
answers
509
views
ModuleNotFoundError: No module named 'musiclibrary.song'
There is an issue while importing model 'Artist' of my django app in views.py.
from musiclibrary.song.models import Artist
when I runserver it gives ModuleNotFoundError.
from django.shortcuts import ...
0
votes
2
answers
541
views
What's the real use of the management/commands directory in the Django Application?
In the documentation, it is written that it can be used for writing custom Django-admin commands. But my question is why do we need to write custom Django admin commands? The given example in the ...
0
votes
2
answers
317
views
Is there a way to add list in a django model class?
I'm a django beginner and trying to make a project from scratch.
My models are :
class Citizen(models.Model):
name = models.CharField(max_length=64, unique=False)
citizen_id = models.CharField(...
1
vote
0
answers
174
views
Django standalone apps with one app depending on another app - django.db.migrations.exceptions.NodeNotFoundError
I am using Django 4.0
I have written two standalone apps. Foo and FooBar.
Application Foo uses package django_nyt. Application FooBar uses functionality from application Foo.
I am able to ...
0
votes
1
answer
149
views
post method is not working in single page django website
I'm learning Django from youtube. now I'm practicing on a project but the problem is the youtube tutorial used multi page django website while i'm developing a single page website where if you click a ...
0
votes
1
answer
77
views
Django custom tags validation
I'm getting this error -> Invalid filter: 'cutter'
while this is my custom tags.py:
from django import template
from random import randint
register = template.Library()
def cutter(list, args):
...
0
votes
1
answer
34
views
How to remove "Unresolved refernce" errror in PyCharm I have changed python interpreter so many times but not working
enter image description here
enter image description here
enter image description here
Guys please help me what should I do? I tried so many times to change the Python Interpreter path also I have ...
0
votes
0
answers
1k
views
Do you think this is the right way to rename a django app?
I read different threads and tutorials on renaming and migrating a Django app (How to rename a Django app and migrate data from an app to the other for instance), I also tried to use the django ...
1
vote
2
answers
122
views
Django app NameError however the app is installed
I'm trying to modify Django's built-in authetnication system by adding a custom user model. The customized model is defined inside an app named accounts:
from django.db import models
from django....
-1
votes
1
answer
2k
views
ModuleNotFoundError: No module named 'app1'
Created a new app named 'app1'.
Have included the app name under INSTALLED_APPS settings.
Got the error 'ModuleNotFoundError: No module named 'app1''
Request your help.
0
votes
1
answer
353
views
Creating subdomain in django
I want to know the proper way of creating subdomain in django. Take for instance, a django project that has more than one apps and you want to assign subdomain to each. Apart from using django-hosts; ...
0
votes
1
answer
700
views
how can I fix a 'IntegrityError at /admin/orders/order/add/' when FOREIGN KEY constraint failed?
I created the order model for Django rest API, and when I tried to add an order I got an error:
django.db.utils.IntegrityError: FOREIGN KEY constraint failed
That's the content of models.py :
from ...
2
votes
2
answers
2k
views
How can I fix a 'ModuleNotFoundError' in django python?
I am trying to create a Django python API, and when I created the first app 'authentication' with 'python manage.py startapp authentication', I got the following error while running the server:
...
0
votes
2
answers
126
views
one django project two apps, problem with generic views( class view)
i have two apps in one project: store and basket.
In urls.py in core of project:
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('jewelry_store.urls', namespace='...
4
votes
2
answers
2k
views
How to send all django error as json data
I am building a rest api in django, I am using postman to test my apis,
Everything is great though I want if any error occurs in my django app so django send me a json error rather than a html page.
...
0
votes
1
answer
794
views
Django application global variables in database best praxis
I am a new in django. I storage global application variables inside settings environment folder. But now i need store variables inside Database because i want changes them from django admin.
My way ...
1
vote
1
answer
207
views
how to create view for django root module
I have a django project with nested smaller apps call: blog, research, report.
I would like to create a view at the root folder (django project level) so that it displays all the blog, research and ...
1
vote
0
answers
521
views
Django AppConfig ready()
I have Django 2.1.7
I read Django documentation as well as, this How to use django AppConfig.ready() and this Overriding AppConfig.ready().
Now, the folder/file structure is like this,
my_app
...
3
votes
1
answer
333
views
install multiple apps by one entry in INSTALLED_APPS in django (dependency)
is the concept of dependencies available in Django apps too?
For example, let's say I'm building my own custom Django app "polls" that can be reused in any Django project.
so whenever you ...
2
votes
4
answers
5k
views
How to create a QR code in Python without saving it as an image?
I am trying to make Qr Codes using Python on a Django applicaiton using this code :
def generate_qr_code (reference):
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants....
0
votes
0
answers
33
views
Tried to create three apps in Django but when try to click on third app it routes to the second app page settings templates DIR allows routing 2 DIRs
in this below code i explained How i rooted the templated but only first two roots are working when click on my third app it automatically rooted to my second app
#--assigning apps templates as values-...
0
votes
2
answers
45
views
onw of my two app is not working in django
Below is my code. In my hello_world project there is two app pages. one is home page and another is profile page. home page is working fine, but profile page is showing error.
hello_world urls.py
from ...
0
votes
1
answer
144
views
Using signals in django, trying to generate code for SMS verification but generated code is not visible in admin. what am i missing?
folder structure
enter image description here
models.py from face_detect
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Profile(models.Model)...
0
votes
1
answer
1k
views
How many separate apps should I have with my Django app
How many apps should I have in my Django project. For instance, I am building a pet application where there can be owners, pets, veterinarians, etc.
For now sticking to only the 3 I mentioned should I ...
0
votes
2
answers
1k
views
How to provide translations for django standalone app inside app?
I would want to provide translation texts (makemessages and write translation strings) inside django-standalone app, to make app support multiple languages. How it can be done?
Currently, I use from ...
1
vote
0
answers
420
views
Can we manage the deployment of each django app within a single Django project independently?
Lets say we have one django project that has two apps - FooApp & BarApp.
Each app talks to its own database. Meaning they both manage their own set of models. Is it possible to manage the ...
1
vote
1
answer
260
views
Extended user registration (to Profileuser) before login, is it possible?
So I am trying to solve this:
Registration -> Registration Profile -> Login
(In admin Registration = User and RegisterPage = Profileuser app)
Got registration working connected to login, but ...
0
votes
2
answers
665
views
How to change the name of a third party app on Django?
I am using django-allauth and its account app conflicts with my account app.
I managed to fix this conflict by creating an app label for allauth.account based on this solution
from django.apps import ...
1
vote
2
answers
2k
views
No installed app with label 'polls' - activating models - error
I am learning Django3.2.5, from https://docs.djangoproject.com/en/3.2/intro/tutorial02/. I created a project with the name, 'mysite', then 'polls' app, and using the default 'SQLite' database.
Project'...
1
vote
1
answer
594
views
matching query does not exist. DoesNotExist at /blog/postComment
I am trying to add the feature of commenting and replying to it in my blog. But it is constantly throwing me the error of "BlogComment matching query does not exist."
def postComment(request)...
-1
votes
1
answer
120
views
virtualenv raises importerror because of changing app name in django
I've used [this link] to rename my django app. So I've edited some files and table's name and so on. But as it has been mentioned in that link, There is problem with virtualenv. So how can I fix it? I'...