repl.it
@AS4/

Django Template-1

Python

Template for running Django with command line. Edited from @Masfrost's repl.

fork
loading
Files
  • main.py
  • main
  • Posts
  • db.sqlite3
  • manage.py
  • Packager files
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os, subprocess

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings")

print('Make sure you fork this before running!\n\nType `python manage.py help` for help, or press enter to start the server.\n\n')


print('Starting shell...\n')

while True:
  cmd = input('\n> ')

  if not cmd:
    cmd = 'python manage.py runserver 0.0.0.0:8000'
    subprocess.run(cmd.split())

  else:  
    subprocess.run(cmd.split())