Questions tagged [django-settings]

A Django settings file is a Python module with module-level variables that contains all the configuration of your Django installation such as, Databases, Installed apps and Media and Static location to name a few.

Django settings file is a Python module with module-level variables that contains all the configuration of your Django installation such as: Databases, Installed apps and Media and Static location to name a few.

Here are a couple of example settings, extracted from the documentation:

DEBUG = False
DEFAULT_FROM_EMAIL = 'webmaster@example.com'
TEMPLATE_DIRS = ('/home/templates/mike', '/home/templates/john')
923 questions
0
votes
2 answers

Django - ImproperlyConfiguredError, Guardian's ANONYMOUS_USER_ID

I am using django-guardian to handle object permissions. In my settings.py: ANONYMOUS_USER_ID = -1 However, when I try to run the server, I get an improperly configured error: django.core.exceptions.ImproperlyConfigured: In order to use…
arcologies
  • 742
  • 1
  • 6
  • 22
0
votes
2 answers

a single filename inside __init__.py facilitating split settings management for django project @readthedocs.org

https://github.com/rtfd/readthedocs.org/tree/master/readthedocs/settings I arrived at the link above from https://code.djangoproject.com/wiki/SplitSettings. Can someone explain how that particular configuration works? Especially, the part played…
Anuvrat Parashar
  • 2,960
  • 5
  • 28
  • 55
0
votes
1 answer

deploy static files with Django modpython

I have always wondered how static files are found by server when using Django. Recently I deployed my Django app to a server and I had trouble deploying static files. I always get the error as following : Using the URLconf defined in cms.urls,…
Gnijuohz
  • 3,294
  • 6
  • 32
  • 47
0
votes
1 answer

Django Database Improperly Configured when function called outside of Django

I'm trying to call a python function that makes some queries into my django database from GNU mailman. When mailman tries to deliver a message, it imports my python script. It later calls a function in my script to modify the message object. The…
user1435114
  • 193
  • 1
  • 11
0
votes
1 answer

Using completely project-independent settings for testing

I'm trying to test an app that creates some custom permissions during intialization. These are created right after database creation: custom_permissions = getattr(settings,'SOMEAPP_PERMISSIONS',() ) def create_custom_permissions(sender, **kwargs): …
marue
  • 5,588
  • 7
  • 37
  • 65
0
votes
1 answer

Use Django logging facility in settings.py

My settings.py contains a lot of imports in try/catch blocks like: try: import gcframe except ImportError: # log gcframe is not available pass etc. I'd like to use Django logger to log which modules are missing, but Django docs…
Paolo
  • 20,112
  • 21
  • 72
  • 113
0
votes
2 answers

Upgraded to Django 1.4 but admin is still looking in media dir for static files

I upgraded to Django 1.4 and now my admin static files won't load. relevant part of my settings file looks like: MEDIA_ROOT = os.path.join(SITE_ROOT, 'media') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing…
Colleen
  • 23,899
  • 12
  • 45
  • 75
-1
votes
2 answers

Keep on getting this error message when trying to run my django server: [Errno 2] No such file or directory

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\nyaknoiton\Desktop\Django 2\manage.py' because it…
-1
votes
2 answers

Django templateview not recognizing my template_name

Currently I have in settings set my main directory to the templates folder so that I have a project level templates. Within that folder I have a home.html file. TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', …
Koomos
  • 13
  • 3
-1
votes
1 answer

pythonanywhere: Something went wrong :-(

When I'm uploading my DRF app to pythonanywhere, the server shows the following log error: 2022-07-15 01:06:14,933: ModuleNotFoundError: No module named 'Rest_API_Framework.settings'. However, I don't understand why, since if we look at…
-1
votes
2 answers

How to structure the templates folder in django and to use the extends

I have a folder, templates, structured like below /Users/AndyKw/Documents/Python/Else/Yes/templates Within templates, I have two folders, admin and registration (see below for the tree) templates (need.html) | |-- admin | |-- registration…
Andy K
  • 4,944
  • 10
  • 53
  • 82
-1
votes
2 answers

Why django not storing files in media folder?

My settings.py MEDIA_ROOT='/static/' MEDIA_URL='media' My urls.py from django.conf import settings from django.conf.urls.static import static urlpatterns=[ #all routes ] if settings.DEBUG: urlpatterns+=static(settings.MEDIA_URL,…
user18380294
-1
votes
1 answer

Why 404 error occurs even though I have set STATIC_ROOT and urls.py

I don't know why, but I get 404 errors when trying to use static file like this: {% static 'js/some.js' %}. Here's my urls.py urlpatterns = [ path('admin/', admin.site.urls), path("account/", include("account.urls")), path("",…
user16987274
-1
votes
1 answer

Django server not starting

I am unable to start the server, it's giving me the error below, i am using only one model and migrations seems to be fine, any clue where i am going wrong in this File "C:\Users\atifs\AppData\Local\Programs\Python\Python39\lib\threading.py", line…
Atif Shafi
  • 954
  • 1
  • 11
  • 26
-1
votes
1 answer

Connect Django to MySql database on VPS

I am trying to run my Django project on a VPS. My Django project uses MySQL. While running it on my local computer I used the following code to connect MySQL to Django DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME':…
Leman Kirme
  • 530
  • 1
  • 5
  • 19
1 2 3
61
62