931 questions
0
votes
0
answers
36
views
Django override settings not being assigned in the __init__ method even though they are available
I am overriding settings for the entire test class like this:
@mock_aws
@override_settings(
AWS_CLOUDFRONT_DOMAIN="fake_domain",
AWS_CLOUDFRONT_KEY="fake_key",
...
-1
votes
1
answer
134
views
Django Environment Identifying the DEBUG as False while it is set to True
I get and error
CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False
Below are the edits I attempted seeing at stackoverflow's suggestion from various queries around 5 of them were ...
1
vote
1
answer
139
views
Django Summernote plugin upload image by userid
I am using the Summernote plugin for Django and my target is to allow users to upload media inside the server. At the moment files are organized (by default) in a folder named with the upload date. ...
1
vote
1
answer
143
views
AxesBackend requires a request as an argument to authenticate
I need to add a restriction on account login attempts to my django site, I found the popular django-axes library, followed the documentation and code examples, but when I try to log in to my account (...
1
vote
1
answer
213
views
Django ignores static configuration for uploading to S3
I had the same problem with media files before, I did all the configuration but django kept saving the media files locally and not in S3, I think it was solved by implementing a custom class ...
1
vote
1
answer
1k
views
Django:: ImproperlyConfigured: Pooling doesn't support persistent connections
I've recently upgraded to Django 5.1 and configured the database pooling option with the following settings:
DATABASES["default"]["OPTIONS"] = {
"pool": {"...
4
votes
0
answers
89
views
Djoser Create User keeps returning field required and is not creating users
I ran into a problem in postman that was not there until yesterday when I was working with it and it was working fine, but now it is not working anymore.
I'm trying to create a user using djoser ...
0
votes
0
answers
107
views
ValueError:The field admin.LogEntry.user was declared with a lazy reference to 'recipes.customuser',but app'recipes'doesn't provide model 'customuser'
This is the Custom user model
I also declared in settings
AUTH_USER_MODEL="recipes.CustomUser"
still I face this error
ValueError:The field admin.LogEntry.user was declared with a lazy ...
1
vote
1
answer
243
views
Issue with Custom 404 Page Rendering in Django
I'm encountering an issue with my custom 404 page rendering functionality in Django. Despite setting up the necessary components, the custom 404 page is not being displayed when a page is not found. ...
1
vote
1
answer
508
views
Issue Adding "django.contrib.gis" to INSTALLED_APPS in Django
I'm currently developing an application using Django and aiming to integrate geospatial functionalities by adding "django.contrib.gis" to my project's INSTALLED_APPS. However, upon adding ...
0
votes
1
answer
65
views
Deployment: Procfile with Django Project Structure for more than one App
I need to know how you normally solve this issue.
When you start a project, django creates a folder for the project and a second one inside it with the exact same name and the files like: settings.py, ...
0
votes
1
answer
91
views
How do I setup "Django" to generate multiple 'STATIC_ROOT' deployment directories in its settings.py?
Here's the problem. When migrating multiple 'STATICFILES_DIRS', I am good to go, and the server continues to run without any errors...
... Here's the snippet to my 'STATICFILES_DIRS' ...
...
...
0
votes
2
answers
333
views
How do I connect to Google Cloud mySQL from App Engine using Django-Environ?
I am trying to connect a Django Google App engine to an instance of Cloud Mysql using django-environ. The app is unable to connect to the database, but otherwise runs successfully.
I have followed ...
0
votes
1
answer
391
views
DRF-Spectacular with django-split-settings: AssertionError: Incompatible AutoSchema to generate Swagger
I am encountering an error when utilizing django-split-settings (version 1.3.0) and drf-spectacular (version 0.27.1) in my Django project. The error occurs when attempting to access the Swagger UI ...
0
votes
1
answer
35
views
Auth email in Django
I am making my first app, which is a todolist app. I am trying to get users to register with email and login with it.
This is the error that the debug shows me:
ProgrammingError at /register/
no ...
1
vote
1
answer
675
views
Difficulty Using gettext_lazy in Django 4 Settings with django-stubs, Resulting in Import Cycle and mypy Type Inference Error
Problem:
Mypy Error:
The mypy error encountered is as follows:
error:Import cycle from Django settings module prevents type inference for 'LANGUAGES' [misc]
I'm encountering challenges with the usage ...
0
votes
0
answers
54
views
Confusing Django settings content using manage.py vs call_command
I have a Django command which I can run using manage.py. The command imports django.conf.settings, then I grab Songs from the database to update bits of the settings:
from django.conf import settings
...
0
votes
1
answer
366
views
Can anyone help? I'm following a tutorial to make a basic blog site using Django and PostgreSQL and I can't add a database
I've added a 'templates' folder into the blog directory but I can't get the Django database urls to recognise it. I think I need to add my url into the settings.py file but I have no idea how I'm ...
3
votes
2
answers
4k
views
Getting DEFAULT_FILE_STORAGE/STORAGES are mutually exclusive when upgraded to 4.2
We are in process to upgrade to django 4.2. However we are facing above issue in running django peroject. We have already setup new way of STORAGES in settings.py i.e.
STORAGES = {
"...
0
votes
1
answer
927
views
ORA-02019 Error When Executing Queries on Remote Oracle DB in Django Application
I'm currently working on a Django application that interacts with an Oracle database. My application needs to execute SQL queries on a remote Oracle database, which is configured in the settings.py ...
7
votes
1
answer
5k
views
USE_L10N deprecated, but it disables DATETIME_INPUT_FORMATS when removed
there's an expanded version of the accepted correct answer in my update to this question below
Have I found a bug in Django?
The config setting USE_L10N is deprecated since 4.0 and scheduled for ...
1
vote
1
answer
180
views
Django Migration Error with PostGIS: 'double free or corruption (out) Aborted (core dumped)
I am developing a web application using Django and encountering a critical issue during database migration with PostGIS. While migrations work seamlessly with the SpatiaLite engine, switching to the ...
1
vote
1
answer
69
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
1
answer
363
views
ModuleNotFoundError: No module named 'mysite.settings' - Django project
I inherited a Django project that another team of students were working on a couple of years ago. I have been trying to run the project using py manage.py runserver but that doesn't work. Instead, I ...
0
votes
1
answer
106
views
Csrf token verification failing for admin form after using AbstractUser class in Deployement?
I am using Django 4.2.4 and created a class with Abstract User class for authentication in Django. Works fine on Localhost but when deployed the admin route is redirecting and csrf verification is ...
1
vote
1
answer
56
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 = [
...
1
vote
1
answer
400
views
Problem to load the Css on a Django application deployed in Vercel
I've created an application in django, but when I deployed it in Vercel, the HTML works just fine, but the CSS don't load. I pasted some of my project below, please ask me if you need any other files ...
12
votes
3
answers
20k
views
Django Allauth - ModuleNotFoundError: No module named 'allauth.account.middleware' even when django-allauth is properly installed
"ModuleNotFoundError: No module named 'allauth.account.middleware'"
I keep getting this error in my django project even when django-allauth is all installed and setup???
I tried even ...
0
votes
2
answers
264
views
Why am I getting a NoneType for Allowed Host in Django-Environ when I set allowed host?
The settings code is
import os
import environ
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
env = environ.Env(DEBUG=(bool, False))
environ.Env.read_env(os.path.join(BASE_DIR,...
0
votes
2
answers
911
views
Why does Django admin render weird?
After hosting my Django project on PythonAnywhere, the Django Admin login page looks like this:
I have run python manage.py collectstatic and this still happens.
There are many errors in the ...
0
votes
1
answer
138
views
what i handel 500 (Internal server error) when url pattern str?
This is my code:
project/urls/py:
from django.contrib import admin
from django.urls import path
from todoapp import views
urlpatterns = [
# admin page
path('admin/', admin.site.urls),
# ...
2
votes
1
answer
944
views
Where to set a custom middleware's path in "MIDDLEWARE" in "settings.py" in Django?
I created the middleware simple_middleware() in middleware/sample.py following the doc as shown below. *I'm learning Middleware:
django-project
|-core
| └-settings.py
|-middleware
| |-__init__....
0
votes
2
answers
84
views
Django-Verify-Email 2.0.3 is not defined even after i installed it
im new to django and im trying to verify users email with Django-Verify-Email 2.0.3. As the documentation says i installed the package and did the same steps as they say but i get this error
...
0
votes
1
answer
195
views
Page not found (404) “/app/media/products/23/05/01/jeans.jpg” does not exist in django
Page not found (404)
“/app/media/products/23/05/01/jeans.jpg” does not exist while delpolying on railway
(as i have turned debug on for the exact error) .
i get this error when i am trying to open my ...
0
votes
0
answers
30
views
Images is not rendering even after giving the correct directory path in Django. but works when I give incomplete directory
So I have the image that I want to display in my page in a subdirectory 'media'.So I wrote this in my settings.py as recommended everywhere in the internet and documentation:
MEDIA_URL = '/media/'
...
-1
votes
2
answers
499
views
Keep on getting this error message when trying to run my django server: [Errno 2] No such file or directory [closed]
I'm trying to run my django server but keep on getting this error, [Errno 2] No such file or directory.
I tried using the cd manage.py command but also got this error cd : Cannot find path 'C:\Users\...
0
votes
1
answer
132
views
Django cannot find template, app is in installed_apps and backend DjangoTemplates is enabled
Inside of a page in my templates folder, I tried using an include statement in a for loop, like so:
{% for model_othermodel in model.othermodels.all%}
{% include othermodels.html with ...
0
votes
1
answer
92
views
configure Django settings for static files with Heroku
I am trying to deploy my Django website using Heroku. So far the site has deployed successfully but the only problem is collecting the static files. I am stuck with how I am supposed to configure my ...
0
votes
3
answers
842
views
Stop Django cache clearing on server refresh
In my Django project I want to stop the cache from clearing whenever the server is restarted. Such as when I edit my views.py file, the cache is cleared and I get logged out which makes editing any ...
0
votes
0
answers
372
views
proper way to import django base settings in production settings
I have seen alot of articles and videos about the best practices when it comes to managing django settings file. And almost of them talks about having a base settings base_settings.py and then ...
0
votes
1
answer
443
views
Override test settings from a file
For context, when one wants to change settings in a test (yes, it's ok to change it there), we can use override_settings() or modify_settings() (as observed here). That works when running the tests in ...
0
votes
1
answer
476
views
ModuleNotFoundError: No module named '"travelApp'
I am using Django to create a web app, and when I tried to use the py manage.py runserver command, I got this error:
ModuleNotFoundError: No module named '"travelApp'
This is the full error:
...
0
votes
1
answer
563
views
What are some ways to display images on server for a Django project? I keep getting 404 errors
A current miniproject that I am working on is a personal cocktail "cookbook" website, where I display different drinks, their recipes, my personal notes, images, etc. I configured the code ...
0
votes
0
answers
402
views
AWS IAM: programmatic access via AWS webpage results an IAM user without `access key ID`. I need it for S3
I'm trying to create an IAM user that can be used for my Django project for serving static files with AWS S3 (also, locally).
For that I need to fill blanks in my Django's settings.py:
""&...
0
votes
0
answers
201
views
connect Oracle 19c database schema/tablespace with Django application
The client provided the single oracle( version 19c ) database in which 2 custom schemas are created and each has a separate tablespace.
I need to connect those schemas/tablespaces with 2 separate ...
1
vote
1
answer
204
views
Settings.py: environment variables -> `getenv` or `environ`. What's better? What's the best approach to be able to, also, see my project locally?
I have one project in production on AWS Elastic Beanstalk. In my settings.py I'm using os.getenv, so I'm able to get my environment variables from AWS Elastic Beanstalk environment properties. I ...
0
votes
1
answer
224
views
How to create test bucket before running tests by django-minio-backend
I use django-minio-backend in order to integrate Django and Minio.
I want to create a test bucket for created media files during tests running.
I tried to do that in a custom test runner as follows:
...
0
votes
0
answers
107
views
Forbidden (CSRF cookie not set.)
I am creating an app in Django, and I am getting this error:
Forbidden (CSRF cookie not set.)
I am using Elastic Beanstalk to host my website, and everything was fine until it started doing this.
My ...
0
votes
0
answers
15
views
Pass capitalised variables to django settings.configure() [duplicate]
I am looking for a way to read from a list of variables and set them in Django settings using the settings.configure() method:
from django.conf import settings
def func(i):
# do something and ...
0
votes
1
answer
421
views
I'm not able to connect proxy host database in Django
after running
python manage.py runserver
Got the Error port 5432 failed: FATAL: Feature not supported: RDS Proxy currently doesn’t support command-line options.
DATABASES = {
'default': {
...