Created
August 20, 2013 13:57
-
-
Save JuniorLima/6281813 to your computer and use it in GitHub Desktop.
Configuração básica de um projeto Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
#!/usr/bin/env python | |
from django.conf import settings | |
from django.contrib.auth import models as auth_models | |
from django.contrib.auth.management import create_superuser | |
from django.db.models import signals | |
signals.post_syncdb.disconnect( | |
create_superuser, | |
sender=auth_models, | |
dispatch_uid='django.contrib.auth.management.create_superuser') | |
def create_admin(app, created_models, verbosity, **kwargs): | |
if not settings.DEBUG: | |
return | |
try: | |
auth_models.User.objects.get(username='admin') | |
except auth_models.User.DoesNotExist: | |
assert auth_models.User.objects.create_superuser('admin', '[email protected]', 'admin') | |
else: | |
print 'Admin, já existe.' | |
signals.post_syncdb.connect(create_admin, | |
sender=auth_models, dispatch_uid='common.models.create_admin') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DJANGO_APPS = ( | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.sites', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
'django.contrib.admin', | |
) | |
ADD_APPS = ( | |
'south', | |
'bootstrap_toolkit', | |
'easy_thumbnails', | |
'auto_create_admin', | |
) | |
PROJETO_APPS = ( | |
'core', | |
'catalog', | |
) | |
INSTALLED_APPS = DJANGO_APPS + ADD_APPS + PROJETO_APPS | |
try: | |
from settings_local import * | |
except ImportError: | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEBUG = True | |
TEMPLATE_DEBUG = DEBUG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment