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 [2018/11/09 10:19] alfred [Libraries] |
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 39: | Línea 39: | ||
| <code> | <code> | ||
| python manage.py shell | python manage.py shell | ||
| + | </code> | ||
| + | |||
| + | If you prefer to use another interpret (in the next case ipython should be installed into the environment): | ||
| + | <code> | ||
| + | python manage.py shell -i ipython | ||
| + | </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> | </code> | ||
| ===== Sections ===== | ===== Sections ===== | ||
| - | [[wiki2:python:django:project]] | ||
| [[wiki2:python:django:apps]] | [[wiki2:python:django:apps]] | ||
| Línea 62: | Línea 95: | ||
| [[wiki2:python:django:tests]] | [[wiki2:python:django:tests]] | ||
| + | [[wiki2:python:django:sites]] | ||
| ===== Other ===== | ===== Other ===== | ||
| + | |||
| + | [[wiki2:python:django:others]] | ||
| [[wiki2:python:medium_django]] | [[wiki2:python:medium_django]] | ||
| + | |||
| + | [[wiki2:python:notes#asyncio_on_django|asyncio and Django]] | ||
| + | |||
| + | [[wiki2:python:django:project]] | ||
| ===== Libraries ===== | ===== Libraries ===== | ||
| * [[https://django-constance.readthedocs.io/en/latest/|Constance: Dynamic settings (on DB)]] | * [[https://django-constance.readthedocs.io/en/latest/|Constance: Dynamic settings (on DB)]] | ||
| + | * [[https://github.com/idlesign/django-etc|Utils that are not on the basic framework]] | ||
| + | * [[https://github.com/lazybird/django-solo|Django-Solo: To create singletones on the DB]] | ||
| + | * [[https://django-tables2.readthedocs.io/en/latest/|Create tables]] | ||
| + | * [[https://github.com/jazzband/django-widget-tweaks|Allow to add properties to the html rendered components]] also [[https://simpleisbetterthancomplex.com/tutorial/2018/11/28/advanced-form-rendering-with-django-crispy-forms.html|Crispy forms]]. | ||
| + | * [[http://whitenoise.evans.io/en/stable/index.html|WhiteNoise: Para que sea Django en producción quien sirva los estáticos sin necesidad de nginx]]. | ||
| + | |||
| + | ===== Links ===== | ||
| + | |||
| + | * [[https://djangosnippets.org/|Django Snippets]] | ||
| + | |||
| + | |||