News 4 U is a Django news application for readers, independent journalists, editors, and curated publications. Every workflow is available through the website; the Django admin is optional and only needed for superuser tasks.
/api/approved/).Run these commands from this directory (the one containing manage.py):
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
if (-not (Test-Path .env)) { Copy-Item .env.example .env }
python manage.py migrate
python manage.py runserver
.env.example selects MariaDB. For a quick demo without MariaDB, set
DB_ENGINE=sqlite in .env before running migrate. See
Development and operations for the MariaDB setup.
Never overwrite an existing .env, and never commit it.
Open http://127.0.0.1:8000/ and use Join to register. Choose a role on the sign-up form:
| Role | What you can do |
|---|---|
| Reader | Subscribe to publishers/journalists and read approved stories. |
| Journalist | Write and manage your own articles and newsletters. |
| Editor | Approve articles, manage content, and manage publishers. |
Install and start Docker Desktop, then run these commands from the project root:
docker build -t news-4-u .
docker run --rm -p 8000:8000 -v news-4-u-data:/data `
-e DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1 news-4-u
The image uses SQLite for a self-contained demo, applies migrations on
startup, and keeps the database in the news-4-u-data Docker volume. Browse
http://127.0.0.1:8000/. For a hosted playground, add its exact host name to
DJANGO_ALLOWED_HOSTS; do not use a wildcard for a public deployment.
This image runs Django’s development server and is for local learning and
testing, not production. Before deploying, configure a unique
DJANGO_SECRET_KEY, a separate random INTERNAL_API_KEY, DJANGO_DEBUG=false,
and the exact production DJANGO_ALLOWED_HOSTS through private environment
variables. Generate keys with Django’s
get_random_secret_key() and Python’s secrets.token_urlsafe(32):
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
python -c "import secrets; print(secrets.token_urlsafe(32))"
Add the generated values to your ignored local .env or pass them as runtime
environment variables. Never put real credentials in the Dockerfile, README,
.env.example, or Git history.
python manage.py test
| Path | Purpose |
|---|---|
config/ |
Settings, root URL configuration, WSGI/ASGI entry points |
accounts/ |
Custom user and roles, registration, subscriptions, permissions |
publications/ |
Publisher model, website management pages |
articles/ |
Articles, newsletters, approval workflow, REST API |
templates/, static/ |
Website templates and styles |
tests/ |
Automated tests |
docs/ |
Detailed guides |
Do not commit .env, database passwords, email credentials, Django secret
keys, or the internal API key. See Development and operations
for the deployment checklist.