10 examples of 'django runserver command' in Python

Every line of 'django runserver command' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
142def _run_management_command(self, command):
143 self.hosts.run(self._get_management_command(command))
103def run(self, **options):
104 """
105 Runs the server, using the autoreloader if needed
106 """
107 use_reloader = options['use_reloader']
108
109 if use_reloader:
110 autoreload.main(self.inner_run, None, options)
111 else:
112 self.inner_run(None, **options)
14def handle(self, *args, **kwargs):
15 from control.server import app
16 if 'fifo' in kwargs:
17 app.fifo_path = kwargs['fifo']
18 if 'manager' in kwargs:
19 app.manager_path = kwargs['manager']
20 app.run('127.0.0.1', port=kwargs['port'])
79@manager.command
80def runserver():
81 import os
82 os.environ['DEBUG'] = 'true'
83 os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = 'true'
84 import config
85 PORT = config.Deployment.PORT
86 HOST = config.Deployment.HOST
87 app.run(
88 port=PORT,
89 host=HOST)
21def run(self):
22 import django
23 from django.conf import settings
24 from django.core.management import call_command
25
26 settings.configure(
27 DATABASES={
28 'default': {
29 'NAME': ':memory:',
30 'ENGINE': 'django.db.backends.sqlite3',
31 }
32 },
33 INSTALLED_APPS=(
34 'django.contrib.auth',
35 'django.contrib.contenttypes',
36 'conditions',
37 'conditions.tests',
38 ),
39 MIDDLEWARE_CLASSES=()
40 )
41 django.setup()
42 call_command('migrate')
43 call_command('test')
7def take_action(self, options):
8 if not options.settings:
9 raise RuntimeError("For start serverm --settings parameter"
10 " is mandatory!")
11 try:
12 settings_cls = load_class(options.settings)
13 except ImportError:
14 raise RuntimeError("Cannot load settings class: {0}".format(options.settings))
15
16 from webtools.application import Application
17 app = Application(settings_cls())
18 app.listen(8888) # TODO: parametrize this
19
20 import tornado.ioloop
21 print("Listeing on :{0}".format(8888))
22 tornado.ioloop.IOLoop.instance().start()
16def run(self):
17 from django.core.management import execute_from_command_line
18 settings_module_name = 'tests.settings'
19 os.environ['DJANGO_SETTINGS_MODULE'] = os.environ.get(
20 'DJANGO_SETTINGS_MODULE',
21 settings_module_name)
22 prev_argv = sys.argv[:]
23
24 this_dir = os.getcwd()
25 testproj_dir = os.path.join(this_dir, 'tests')
26 os.chdir(testproj_dir)
27 sys.path.append(testproj_dir)
28
29 try:
30 sys.argv = [__file__, 'test'] + self.extra_args
31 execute_from_command_line(argv=sys.argv)
32 finally:
33 sys.argv[:] = prev_argv
49@task
50def runserver():
51 """Run CRITs using the built-in runserver."""
52 with cd(APP_ROOT):
53 run("python manage.py runserver 0.0.0.0:8080")
237def runserver():
238 manage_py = project_relative("manage.py")
239 local("python %s runserver 0.0.0.0:8000" % manage_py)
17def run(self, args, opts):
18 try:
19 from scrapyd.script import execute
20 execute()
21 except ImportError:
22 raise UsageError("Scrapyd is not available in this system")

Related snippets