Просто мои записки и не более того, как раньше говорил апач "Move along, nothing to see here ;)"
Search This Blog
Showing posts with label python3. Show all posts
Showing posts with label python3. Show all posts
Friday, November 11, 2016
Tuesday, June 10, 2014
small notes about django and etc
Just to remember, how to get project bse directory in django projects:
settings.py
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
print(BASE_DIR)
# How to tell django ignore requests like /favicon.ico and etc.
settings.py
import re
IGNORABLE_404_URLS = (
re.compile(r'^/favicon\.ico$'),
re.compile(r'^/robots\.txt$'),
)
# How to serve static files in dev
settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_URL = '/s/'
STATIC_ROOT = ''
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'), # <- only one static files directory
)
Some magic in widget configuration
widget = forms.Select(attrs = {'onchange': 'this.form.submit();'})
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U
Subscribe to:
Posts (Atom)