Herramientas de usuario

Herramientas del sitio


wiki2:python:basic_django

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
wiki2:python:basic_django [2018/10/13 08:36]
alfred [Sections]
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 21: Línea 21:
 <​code>​ <​code>​
 python manage.py startapp polls python manage.py startapp polls
 +</​code>​
 +
 +Create app in a different folder than root which should exist:
 +<​code>​
 + ​python manage.py startapp coopolis apps/​coopolis
 </​code>​ </​code>​
  
Línea 34: 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 46: Línea 84:
  
 [[wiki2:​python:​django:​models]] [[wiki2:​python:​django:​models]]
 +
 +[[wiki2:​python:​django:​forms]]
  
 [[wiki2:​python:​django:​auth]] [[wiki2:​python:​django:​auth]]
Línea 55: Línea 95:
 [[wiki2:​python:​django:​tests]] [[wiki2:​python:​django:​tests]]
  
 +[[wiki2:​python:​django:​sites]]
 +===== Other =====
 +
 +[[wiki2:​python:​django:​others]]
 +
 +[[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/​|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]] 
 + 
  
wiki2/python/basic_django.1539419794.txt.gz · Última modificación: 2020/05/09 09:24 (editor externo)