A simple Django blog with posts, accounts, static assets, and media uploads.
Built with Django. Repo includes
accounts/,posts/,static/, andmedia/. There’s also abloggg/app that you can keep or rename toblogfor clarity.
git clone https://github.com/eddipa/Solid_Blog.git
cd Solid_Blog
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install --upgrade pip
pip install django django-environ whitenoise pillowCreate config/ with base.py, dev.py, prod.py as in this README.
Set the default:
export DJANGO_SETTINGS_MODULE=config.dev(Windows PowerShell: setx DJANGO_SETTINGS_MODULE "config.dev" then reopen the shell)
Create a .env file at project root:
SECRET_KEY=replace-this
DEBUG=True
ALLOWED_HOSTS=["localhost","127.0.0.1"]
TIME_ZONE=Europe/Berlin
# DATABASE_URL=postgresql://user:pass@host:5432/dbnamepython manage.py migrate
python manage.py createsuperuser
python manage.py collectstatic --noinput # safe to run; dev ignores STATIC_ROOT
python manage.py runserverVisit: http://127.0.0.1:8000/
Solid_Blog/
accounts/
posts/
bloggg/ # consider renaming to 'blog'
static/ # your CSS/JS/images (not collected)
media/ # user uploads (keep out of git)
config/
__init__.py
base.py
dev.py
prod.py
templates/ # create and add base.html, etc.
manage.py
-
Static & media
STATIC_URL=/static/,STATICFILES_DIRS=["static"]MEDIA_URL=/media/,MEDIA_ROOT=media/- In production,
collectstaticgathers tostaticfiles/and WhiteNoise serves them.
-
Apps
posts: your blog posts (addslug,status,published_at,featured_image)accounts: auth/profile bitsbloggg: legacy or second blog app; you can merge intopostsor rename toblog.
-
Admin
- Prepopulate slugs:
prepopulated_fields={"slug": ("title",)} - Add list filters for status/date; search by title/body.
- Prepopulate slugs:
pip install pytest pytest-django ruff black isort
pytest
ruff check .
black --check .
isort --check-only .- Environment:
DJANGO_SETTINGS_MODULE=config.prod,SECRET_KEY,ALLOWED_HOSTS,DATABASE_URL(Postgres recommended). - Static: run
collectstaticduring build. - WSGI:
gunicorn config.wsgi:application. - Reverse proxy: ensure
X-Forwarded-ProtosoSECURE_SSL_REDIRECTbehaves.
This project is licensed under the MIT License. See LICENSE for details.