twoscoops / two-scoops-of-django-1.8

Tracking thoughts and feature requests for Two Scoops of Django 1.8 in the issue tracker. And the book's code examples are here.
400 stars 81 forks source link

Add @rosarior's https://github.com/rosarior/django-autoadmin #25

Closed pydanny closed 9 years ago

luzfcb commented 9 years ago

Cool. My ugly solution was to create a migration + environment variables.

from https://github.com/luzfcb/cookiecutter-django/blob/test-deploy/deploy_by_travis.sh#L47-L78 ps. This code come from the my attempts to test the cookiecutter-django based project in Heroku.

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from users.models import User

import environ
env = environ.Env()

def forwards(apps, schema_editor):

    user = User.objects.create_superuser(
        username=env('DJANGO_ADMIN_USERNAME'),
        email=env('DJANGO_ADMIN_EMAIL'),
        password=env('DJANGO_ADMIN_PASSWORD')
    )

class Migration(migrations.Migration):

    dependencies = [
        ('users', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(forwards),
    ]
pydanny commented 9 years ago

:ship:

@rosarior's package is in the security chapter and packages appendix.