Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
wiki2:python:basic_django [2019/08/09 14:42] alfred [Commands to manage the project] |
wiki2:python:basic_django [2021/02/08 18:44] (actual) |
||
|---|---|---|---|
| Línea 10: | Línea 10: | ||
| Create a Django project: | Create a Django project: | ||
| <code> | <code> | ||
| - | django-admin startproject mysite | + | django-admin startproject mysite . |
| </code> | </code> | ||
| Línea 45: | Línea 45: | ||
| python manage.py shell -i ipython | python manage.py shell -i ipython | ||
| </code> | </code> | ||
| + | |||
| + | ===== Minimum Django ===== | ||
| + | |||
| + | * From: [[https://github.com/syntarsus/minimal-django|Minimal Django repo]] | ||
| + | |||
| + | <code python> | ||
| + | import sys | ||
| + | |||
| + | from django.conf import settings | ||
| + | from django.conf.urls import url | ||
| + | from django.core.management import execute_from_command_line | ||
| + | from django.http import HttpResponse | ||
| + | |||
| + | settings.configure( | ||
| + | DEBUG=True, | ||
| + | ROOT_URLCONF=sys.modules[__name__], | ||
| + | ) | ||
| + | |||
| + | |||
| + | def index(request): | ||
| + | return HttpResponse('<h1>A minimal Django response!</h1>') | ||
| + | |||
| + | urlpatterns = [ | ||
| + | url(r'^$', index), | ||
| + | ] | ||
| + | |||
| + | if __name__ == '__main__': | ||
| + | execute_from_command_line(sys.argv) | ||
| + | </code> | ||
| + | |||
| ===== Sections ===== | ===== Sections ===== | ||
| - | [[wiki2:python:django:project]] | ||
| [[wiki2:python:django:apps]] | [[wiki2:python:django:apps]] | ||
| Línea 66: | Línea 95: | ||
| [[wiki2:python:django:tests]] | [[wiki2:python:django:tests]] | ||
| + | [[wiki2:python:django:sites]] | ||
| ===== Other ===== | ===== Other ===== | ||
| Línea 71: | Línea 101: | ||
| [[wiki2:python:medium_django]] | [[wiki2:python:medium_django]] | ||
| + | |||
| + | [[wiki2:python:notes#asyncio_on_django|asyncio and Django]] | ||
| + | |||
| + | [[wiki2:python:django:project]] | ||
| ===== Libraries ===== | ===== Libraries ===== | ||
| Línea 83: | Línea 117: | ||
| * [[https://djangosnippets.org/|Django Snippets]] | * [[https://djangosnippets.org/|Django Snippets]] | ||
| + | |||
| + | |||
| + | |||