All technological notes.

git clone https://github.com/simonangel-fong/Django_Blog.git
cd Django_Blog
py -m venv env # create virtual environment
python.exe -m pip install --upgrade pip # upgrade pip
pip install django
pip list
django_blogdjango-admin startproject django_blog # Start project
py ./django_blog/manage.py runserver 8000 # Starts a lightweight development web server locally
Create VSCode launch.json file
Update .gitignore
.vscode/
django_blog/views.pyfrom django.views.generic.base import TemplateView
# View of home page
class HomeView(TemplateView):
template_name = "index.html" # the template of this view
# define the context data
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# a dictionary representing the context
context["msg"] = "hellow world"
return context
django_blog/urls.pyfrom django.contrib import admin
from django.urls import path
from .views import HomeView
urlpatterns = [
path('', HomeView.as_view(), name="home"),
path('admin/', admin.site.urls),
]
Create template files
django_blog/templates/layout
base.htmlnav.htmlfooter.htmldjango_blog/templates/
index.htmlArguswatcher/static/
css/style.cssimg/home.pngArguswatcher/Arguswatcher/settings.py# region Static
# URL to use when referring to static files located in STATIC_ROOT.
STATIC_URL = 'static/'
# defines the additional locations the staticfiles app will traverse
STATICFILES_DIRS = [
BASE_DIR / 'static',
]
# The absolute path to the directory where collectstatic will collect static files for deployment.
STATIC_ROOT = Path(BASE_DIR, 'collectstatic')
# endregion
py ./Arguswatcher/manage.py collectstatic
# creating new migrations based on the changes
py ./Arguswatcher/manage.py makemigrations # No changes detected
# applying migrations.
py ./Arguswatcher/manage.py migrate # Apply all migrations: admin, auth, contenttypes, sessions


pip freeze > requirements.txt
git add -A # Add all file contents to the index.
git log --oneline -4 # Show commit logs
git commit -m "create django project Arguswatcher" # Record changes to the repository
git push # Update remote repo