Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

vineet-k09/weekplanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeekPlanner

WeekPlanner

A minimal Django app for navigating through daily task pages, showcasing simple routing and template rendering.

🛠️ Initialize

Step 1: Create project and app

django-admin startproject weekplanner
cd weekplanner
python manage.py startapp tasks

Step 2: weekplanner/settings.py

INSTALLED_APPS = [
'tasks',
]

Step 3: Place HTML files inside

tasks/templates/tasks/

Step 4: tasks/views.py

from django.shortcuts import render

def index(request):
return render(request, 'tasks/index.html')

def monday(request):
return render(request, 'tasks/monday.html')

...similarly for other days

Step 5: tasks/urls.py

from django.urls import path
from . import views

urlpatterns = [
path('', views.index, name='index'),
path('monday/', views.monday, name='monday'),
...add more days here
]

Step 6: weekplanner/urls.py

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('tasks/', include('tasks.urls')),
]

Step 7: requirements.txt

Django>=3.2,<4 gunicorn

Step 8: weekplanner/settings.py

ALLOWED_HOSTS = ['weekplanner-zntz.onrender.com']

🚀 Run Dev

Create virtual environment at root level

python -m venv .venv

Activate virtual environment

.venv\Scripts\activate

Run development server

(.venv) python manage.py runserver

pip install django -- incase shows module not found technically it should

👀 Adding styles

weekplanner/static/css/styles.css

settings.py

STATIC_URL = 'static/'

STATICFILES_DIRS = [
BASE_DIR / "static", # This points to the static directory
]

Styles config for serving thru Render

settings.py

STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / "static"]
STATIC_ROOT = BASE_DIR / "staticfiles"

python manage.py collectstatic -- before each deployment it seems

settings.py

MIDDLEWARE = [
    'whitenoise.middleware.WhiteNoiseMiddleware',
    # ... the rest
]

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

pip install whitenoise -- WhiteNoise lets Django serve static files without needing Nginx or some external server.

To autogenerate requirements.txt

pip freeze > requirements.txt

Procfile

Tell your platform how to run your app Put this file in your root directory (no extension), and inside write:

web: gunicorn weekplanner.wsgi:application

About

A Django app to view weekly tasks exhibiting routing between pages.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published