Hello, why not is possible override the command runserver.py in my custom app in Django 1.7, like this
-- # encoding: utf-8
from django.conf import settings
from django.core.management.base import CommandError, BaseCommand
# from django.contrib.staticfiles.management.commands.runserver import Command as RunserverCommand
from django.core.management.commands.runserver import Command as RunserverCommand
class Command(RunserverCommand):
def handle(self, addrport='', *args, **options):
database = options.get('database', 'default')
if (settings.DATABASES[database]['ENGINE'] == 'saas.backends.postgresql_psycopg2' or
RunserverCommand is BaseCommand):
raise CommandError("migrate has been disabled, for database '{}'. Use migrate_schemas "
"instead. Please read the documentation if you don't know why you "
"shouldn't call migrate directly!".format(database))
super(Command, self).handle(self, addrport='', *args, **options)
def check_migrations(self):
"""
Checks to see if the set of migrations on disk matches the
migrations in the database. Prints a warning if they don't match.
"""
print('OK')
The output when i run manage.py, note that the runserver is not present in [saas] commands
The output when i run manage.py, note that the runserver is not present in [saas] commands
Available subcommands:
[auth]
..
[debug_toolbar]
..
[django]
..
[reversion]
...
[saas]
migrate
migrate_saas
migrate_schemas
sync_schemas
syncdb
tenant_command
[sessions]
..
[staticfiles]
collectstatic
findstatic
runserver
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6d16ea0e-accc-4c3a-81cd-2e98ccf24fc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment