-
Notifications
You must be signed in to change notification settings - Fork 0
/
whattodo.txt
26 lines (20 loc) · 1.05 KB
/
whattodo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
set up a new Python virtual environment and activate it ( python -m venv .venv and then .venv\Scripts\Activate.ps1)
install Django and Black in the new virtual environment (python -m pip install django~=4.2.0 etc)
django-admin startproject django_projectname .
python manage.py startapp appname
update django_project/settings.py to alert Django to the new app, posts, by adding it to the bottom of the INSTALLED_APPS section.
python manage.py migrate (python manage.py makemigrations if needed)
python manage.py createsuperuser
PER LE IMMAGINI:
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media' in settings.py
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) nel main urls
<img src="{{ post.img.url }}">
gg
aggiornare requirements: pip freeze > requirements.txt
CELERY:
creare celery.py con i settings nella main app
creare tasks.py nelle altre app con le task da fare
importare la task nelle views per usarla in una funzione definita nelle views
triggerare la funzione nelle views dagli urls
action="{% url 'nometaskviews' %}" per usarla