Django Journey

15APR2025

python manage.py runserver 0.0.0.0:80 for LAN access

python manage.py flush   to restart DB from scratch.

pip -V    will confirm if you in the venv

02APR2025


Probably better to use . foldername, while ensuring ,gitignore has this.

python -m venv .venv
.venv\Scripts\activate
pip install django

22FEB2025

python -m venv env
env\Scripts\activate
pip install django


deactivate
env\Scripts\activate

13FEB2025


python manage.py makemigrations

and then

python manage.py migrate

python manage.py createsuperuser   

python manage.py changepassword <user_name>


06FEB2025

Use the setup instructions for creating a github project in website first, then clone it locally.

Now you have C:\Source\github\bendecko\projectname\

Navigate to that folder and run django-admin startproject longtermreviews .     (note .)

This creates the standard structure:


Where my_site is projectname (master) and blog,reviews,user,login etc is module/app level.  We don't have blog yet.  To get it, run:


python manage.py startapp user  - Creates "user" application

31JAN2025

Consider Jinja2 as templating language. maybe be that render engine parameter...



30JAN2025

Create Project

from command-line where you want the project to appear:

django-admin startproject <projectname>

django-admin startproject leaveflickr
cd leaveflickr
django-admin startapp photos

Virtual Environment

from command-line where you want the venv to appear:

python -m venv jafri

pip install django

then cd into ./Scripts and "activate" using the batch file.

PIP

pip list  - show all packages

pip freeze > requirements.txt    - 

Run Project

python manage.py runserver

manage.py

python manage.py startapp user  - Creates "user" application


23AUG2024

https://medium.com/jina-ai/building-an-ai-powered-pdf-search-engine-with-python-part-1-9102654e6ea1




File Uploads:

From Max's course.   Interestingly he creates/uses a "profile" app in Django.

https://www.udemy.com/course/python-django-the-practical-guide/learn/lecture/26399314#overview

request.FILES["image"] in view contains files collection.

from form definition:

<form action="/profiles" method="POST" enctype="multipart/form-data">
    { csrf_token }
    <input type="file" name="image" />
    <button>upload</button>
</form>

In the view look for chunk.

This will be replaced by dropzone upload in longtermreviews






Comments

Popular posts from this blog

github start project

Solr worked example with National Trees, from "Ground up" :)