@ArchieMaclean/

Django Template

Python

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

fork
loading
Files
  • main.py
  • main
  • db.sqlite3
  • manage.py
  • requirements.txt

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.9757755375649946","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IG9zLCBzdWJwcm9jZXNzCgpvcy5lbnZpcm9uLnNldGRlZmF1bHQoIkRKQU5HT19TRVRUSU5HU19NT0RVTEUiLCAibWFpbi5zZXR0aW5ncyIpCgpwcmludCgnTWFrZSBzdXJlIHlvdSBmb3JrIHRoaXMgYmVmb3JlIHJ1bm5pbmchXG5cblR5cGUgYHB5dGhvbiBtYW5hZ2UucHkgaGVscGAgZm9yIGhlbHAsIG9yIHByZXNzIGVudGVyIHRvIHN0YXJ0IHRoZSBzZXJ2ZXIuXG5cbicpCgoKcHJpbnQoJ1N0YXJ0aW5nIHNoZWxsLi4uXG4nKQoKd2hpbGUgVHJ1ZToKICBjbWQgPSBpbnB1dCgnXG4+ICcpCgogIGlmIG5vdCBjbWQ6CiAgICBjbWQgPSAncHl0aG9uIG1hbmFnZS5weSBydW5zZXJ2ZXIgMC4wLjAuMDo4MDAwJwogICAgc3VicHJvY2Vzcy5ydW4oY21kLnNwbGl0KCkpCgogIGVsc2U6ICAKICAgIHN1YnByb2Nlc3MucnVuKGNtZC5zcGxpdCgpKQo="},"asBuffer":null},"loaded":true}}
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())