Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- from datetime import datetime
- DATABASES = {
- 'default': {
- # the usual lines ...
- TEST_NAME: '{user}_{epoch_ts}_awesome_app'.format(
- user=os.environ.get('USER', os.environ['LOGNAME']),
- # This gives the number of seconds since the UNIX epoch
- epoch_ts=int((datetime.utcnow() - datetime.utcfromtimestamp(0)).total_seconds())
- ),
- # etc
- }
- }
- from django.conf import settings
- # This is bad because settings might still be in the process of being
- # configured at this stage.
- blah = settings.BLAH
- def some_view():
- # This is okay because by the time views are called by Django,
- # the settings are supposed to be all configured.
- blah = settings.BLAH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement