Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test server reloads code changes :)

  • Loading branch information...
commit 2b17368868ea10fa365295d6004594496537ed45 1 parent 7bed933
@digi604 digi604 authored
Showing with 21 additions and 21 deletions.
  1. +2 −2 cms/test_utils/cli.py
  2. +19 −19 runtestserver.py
View
4 cms/test_utils/cli.py
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
+from django.utils.functional import empty
import os
gettext = lambda s: s
-
urlpatterns = []
-
def configure(**extra):
from django.conf import settings
os.environ['DJANGO_SETTINGS_MODULE'] = 'cms.test_utils.cli'
@@ -183,6 +182,7 @@ def configure(**extra):
)
)
defaults.update(extra)
+ settings._wrapped = empty
settings.configure(**defaults)
from cms.conf import patch_settings
patch_settings()
View
38 runtestserver.py
@@ -2,6 +2,7 @@
from cms.test_utils.cli import configure
from cms.test_utils.tmpdir import temp_dir
import argparse
+from django.utils import autoreload
import os
import sys
@@ -25,22 +26,23 @@ def main():
}
}
)
- from django.core.management import call_command
- call_command('syncdb', interactive=False, migrate_all=new_db)
- call_command('migrate', interactive=False, fake=new_db)
- from django.contrib.auth.models import User
- if not User.objects.filter(is_superuser=True).exists():
- usr = User()
- usr.username = 'admin'
- usr.email = 'admin@admin.com'
- usr.set_password('admin')
- usr.is_superuser = True
- usr.is_staff = True
- usr.is_active = True
- usr.save()
- print
- print "A admin user (username: admin, password: admin) has been created."
- print
+ if os.environ.get("RUN_MAIN") != "true":
+ from django.core.management import call_command
+ call_command('syncdb', interactive=False, migrate_all=new_db)
+ call_command('migrate', interactive=False, fake=new_db)
+ from django.contrib.auth.models import User
+ if not User.objects.filter(is_superuser=True).exists():
+ usr = User()
+ usr.username = 'admin'
+ usr.email = 'admin@admin.com'
+ usr.set_password('admin')
+ usr.is_superuser = True
+ usr.is_staff = True
+ usr.is_active = True
+ usr.save()
+ print
+ print "A admin user (username: admin, password: admin) has been created."
+ print
from django.contrib.staticfiles.management.commands import runserver
rs = runserver.Command()
rs.stdout = sys.stdout
@@ -49,9 +51,7 @@ def main():
rs._raw_ipv6 = False
rs.addr = args.bind
rs.port = args.port
- rs.inner_run(addrport='%s:%s' % (args.bind, args.port),
- insecure_serving=True)
-
+ autoreload.main(rs.inner_run, (),{'addrport':'%s:%s' % (args.bind, args.port), 'insecure_serving':True, 'use_threading':True})
if __name__ == '__main__':
main()
Please sign in to comment.
Something went wrong with that request. Please try again.