Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 58 lines (53 sloc) 2.086 kb
c48cd0e @ojii Improved runtests
ojii authored
1 #!/usr/bin/env python
2 from cms.test_utils.cli import configure
3 from cms.test_utils.tmpdir import temp_dir
4 import argparse
5 import os
6 import sys
7
8
9 def main():
10 parser = argparse.ArgumentParser()
11 parser.add_argument('-p', '--port', default='8000')
12 parser.add_argument('-b', '--bind', default='127.0.0.1')
13 args = parser.parse_args()
14 new_db = not os.path.exists('cmstestdb.sqlite')
15 with temp_dir() as STATIC_ROOT:
16 with temp_dir() as MEDIA_ROOT:
17 configure(
18 ROOT_URLCONF='cms.test_utils.project.urls',
19 STATIC_ROOT=STATIC_ROOT,
20 MEDIA_ROOT=MEDIA_ROOT,
21 DATABASES = {
22 'default': {
23 'ENGINE': 'django.db.backends.sqlite3',
24 'NAME': 'cmstestdb.sqlite',
25 }
26 }
27 )
28 from django.core.management import call_command
29 call_command('syncdb', interactive=False, migrate_all=new_db)
30 call_command('migrate', interactive=False, fake=new_db)
31 from django.contrib.auth.models import User
32 if not User.objects.filter(is_superuser=True).exists():
33 usr = User()
34 usr.username = 'admin'
35 usr.email = 'admin@admin.com'
36 usr.set_password('admin')
37 usr.is_superuser = True
38 usr.is_staff = True
39 usr.is_active = True
40 usr.save()
41 print
42 print "A admin user (username: admin, password: admin) has been created."
43 print
44 from django.contrib.staticfiles.management.commands import runserver
45 rs = runserver.Command()
46 rs.stdout = sys.stdout
47 rs.stderr = sys.stderr
48 rs.use_ipv6 = False
49 rs._raw_ipv6 = False
50 rs.addr = args.bind
51 rs.port = args.port
52 rs.inner_run(addrport='%s:%s' % (args.bind, args.port),
53 insecure_serving=True)
54
55
56 if __name__ == '__main__':
57 main()
Something went wrong with that request. Please try again.