With this awesome manage.py, it will try to migrate first when called with runserver.
Also, this manege.py has super power to be used in your entry point as such:
entry_points = {
'console_scripts': [
# u haz a setup.py -> u haz importable module :)
'yourcommand = yourproject.manage:main',
],
},
Example output:
$ yourcommand runserver
Operations to perform:
Apply all migrations: auth, contenttypes, admin, sessions
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying sessions.0001_initial... OK
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
No migrations to apply.
Performing system checks...
Username (leave blank to use 'jpic'):
Email address: [email protected]
Password:
Password (again):
Superuser created successfully.
Welcome in 2017, where automation is king
System check identified no issues (0 silenced).
September 17, 2017 - 21:21:41
Django version 1.9.10, using settings 'crudlfap_example.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Extra note: it doesn't matter if migrate crashes for now, since django runserver doesn't support not being able to connect to database. So most of the time I hope to shouldn't need to disable this hack.