Differenze

Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.

Link a questa pagina di confronto

Entrambe le parti precedenti la revisioneRevisione precedente
Prossima revisione
Revisione precedente
python:django:how_to [2023/10/10 11:00] – WIP apressatopython:django:how_to [2023/10/10 17:03] (versione attuale) – WIP apressato
Linea 49: Linea 49:
           wsgi.py           wsgi.py
  
-===== Creazione App(s) =====+===== Creating an App ===== 
 +Create an app using 
 + 
 +<cli prompt="(.venv) path/to/project> " > 
 +(.venv) path/to/project> python manage.py startapp <app_name> 
 +</cli> 
 + 
 +Inside the ''app_name'' folder create the file //''urls.py''// 
 + 
 +<cli type=dos> 
 +cd app_name 
 +touch urls.py 
 +</cli> 
 + 
 +The project directory should now look like this: 
 + 
 +  project_name/ 
 +      manage.py 
 +      db.sqlite3 
 +      project_name/ 
 +          __init__.py 
 +          settings.py 
 +          urls.py 
 +          wsgi.py 
 +          asgi.py 
 +      app_name/ 
 +          migrations/ 
 +              __init__.py 
 +          __init__.py 
 +          admin.py 
 +          apps.py 
 +          models.py 
 +          tests.py 
 +          urls.py 
 +          views.py 
 + 
 +To include this app in your project, add your app to the **''INSTALLED_APPS''** list in the ''settings.py'' file 
 + 
 +<code python> 
 +INSTALLED_APPS = [ 
 + 'app', 
 + # ... 
 +
 +</code> 
  
 ===== Views ===== ===== Views =====
Linea 74: Linea 118:
  
  
 +===== Important Settings =====
  
python/django/how_to.1696935654.txt.gz · Ultima modifica: 2023/10/10 11:00 da apressato
Torna su
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0