settings

Which part should the package configuration in Python script?

Which part should the package configuration in Python script? Question: I have few code which set the configuration for logging and package setting. pd.set_option(‘display.max_columns’, None) logging.getLogger("urllib3").setLevel(logging.ERROR) Where should I put these into the script (under import, under if __name__ == "__main__", etc) or can I create a configuration file for setting configuration? import pybit import …

Total answers: 1

Conditionally set particular cell (index, 'column') value in dataframe in Python

Conditionally set particular cell (index, 'column') value in dataframe in Python Question: I need to conditionally set value of each row of a particular column in a dataframe. If the condition meets then the particular cell should be changed according to variable provided in the list, otherwise it should remain as it is. Please find …

Total answers: 2

django.core.exceptions.ImprperlyConfigured solution

django.core.exceptions.ImprperlyConfigured solution Question: I wonder why I get this error : django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. this is my code : from main_app.models import student std1 = student(name=’tom’, fullname=’scholz’) std1.save() print(student.objects.all()) there is not any problem with …

Total answers: 3

Storing the secrets (passwords) in a separate file

Storing the secrets (passwords) in a separate file Question: What’s the simplest way to store the application secrets (passwords, access tokens) for a Python script? I thought it’d be a *.yml file like in Ruby but surprisingly I found that it wasn’t the case. So what is it then? What are the most simplest solutions? …

Total answers: 3

Django: ImproperlyConfigured: The SECRET_KEY setting must not be empty

Django: ImproperlyConfigured: The SECRET_KEY setting must not be empty Question: I am trying to set up multiple setting files (development, production, ..) that include some base settings. Cannot succeed though. When I try to run ./manage.py runserver I am getting the following error: (cb)clime@den /srv/www/cb $ ./manage.py runserver ImproperlyConfigured: The SECRET_KEY setting must not be …

Total answers: 33

Unable to serve static files like css, js in django python

Unable to serve static files like css, js in django python Question: I am very new to django, and gone through tutorial for many days , i have started building a small website using django and trying to serve a css file by arranging all the necessary settings in settings.py file. But unfortunately my code …

Total answers: 5

Django Local Settings

Django Local Settings Question: I’m trying to use local_setting in Django 1.2, but it’s not working for me. At the moment I’m just adding local_settings.py to my project. settings.py DATABASES = { ‘default’: { ‘ENGINE’: ‘django.db.backends.mysql’, # Add ‘postgresql_psycopg2’, ‘postgresql’, ‘mysql’, ‘sqlite3’ or ‘oracle’. ‘NAME’: ‘banco1’, # Or path to database file if using sqlite3. …

Total answers: 8

ConfigObj/ConfigParser vs. using YAML for Python settings file

ConfigObj/ConfigParser vs. using YAML for Python settings file Question: Which is better for creating a settings file for Python programs, the built-in module (ConfigParser) or the independent project (ConfigObj), or using the YAML data serialization format? I have heard that ConfigObj is easier to use than ConfigParser, even though it is not a built-in library. …

Total answers: 3

Change browser proxy settings from Python?

Change browser proxy settings from Python? Question: I have written a program that relies on a proxy to function. I now need a script that will check to see if the browser is set to use the right proxy, and if not, change it to use it. I need this implemented for as many browsers …

Total answers: 3

What's the official way of storing settings for Python programs?

What's the official way of storing settings for Python programs? Question: Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information. Are one of these approaches blessed by Guido and/or the Python community more than another? Asked By: Steven Hepting …

Total answers: 13