Skip to content

docs: improve setup instructions, add .env.sample and basic test#1051

Closed
AkramZaabi wants to merge 1 commit into
alphaonelabs:mainfrom
AkramZaabi:improve-setup-docs
Closed

docs: improve setup instructions, add .env.sample and basic test#1051
AkramZaabi wants to merge 1 commit into
alphaonelabs:mainfrom
AkramZaabi:improve-setup-docs

Conversation

@AkramZaabi
Copy link
Copy Markdown

@AkramZaabi AkramZaabi commented Mar 30, 2026

Summary

  • Rewrote README.md setup flow with clearer local dev steps
  • Added cross-platform instructions (Windows/macOS/Linux)
  • Documented ASGI/Uvicorn startup path and custom admin URL
  • Added “Common Errors” section
  • Reworked .env.sample to match runtime env vars
  • Removed stale/misleading entries (unused debug flags)
  • Grouped env vars with comments by purpose
  • Synced .github/copilot-setup-steps.yml with README
  • Added regression test to keep .env.sample aligned with runtime settings

Why This Helps

  • Eases onboarding for new contributors
  • Reduces confusion from outdated setup instructions/env vars
  • Adds a guardrail to prevent future misalignment

Testing

  • Verified .env.sample covers runtime env vars
  • Confirmed removal of unused DEBUG/DJANGO_DEBUG entries
  • Syntax check passed for new test file (python -m py_compile)

Summary

This PR improves onboarding documentation and setup instructions for new contributors by streamlining the README, standardizing environment configuration, and adding automated validation tests.

Key Changes

README.md - Complete rewrite replacing outdated documentation with a simplified "Quick Start" workflow:

  • Consolidated setup steps for macOS/Linux and Windows using venv and Poetry
  • Removed legacy sections (Docker setup, detailed development guidelines, unnecessary infrastructure details)
  • Replaced fixed admin URL references with dynamic ADMIN_URL environment variable
  • Updated tech stack description to focus on core tools (Django, Channels, Uvicorn, Redis, SQLite)
  • Added "Common Errors" troubleshooting section addressing ASGI/WebSockets, CSRF/host configuration, Redis connectivity, and MySQL client issues

.env.sample - Reorganized from production-oriented to development-focused baseline:

  • Removed stale entries (DEBUG, DJANGO_DEBUG flags; deployment/VPS-specific fields)
  • Added development necessities (encryption keys, Django security settings, local service URLs, notification credentials)
  • Grouped variables by purpose with explanatory comments (authentication, caching, cloud storage, integrations)
  • Changed email provider reference from SendGrid to Mailgun with Slack fallback

.github/copilot-setup-steps.yml - Updated to align with new instructions:

  • Updated dev server command to use poetry run uvicorn instead of manage.py runserver
  • Changed server endpoint from localhost hardcoded URLs to 127.0.0.1:8000/en/ with admin URL controlled via .env
  • Updated tech stack reference from SendGrid to Mailgun

web/tests/test_env_sample.py - New regression test suite:

  • Validates .env.sample contains all variables referenced in runtime settings
  • Ensures .env.sample doesn't contain deprecated debug flags
  • Acts as guardrail to prevent future misalignment

Impact

  • Eases contributor onboarding with clearer, consolidated setup instructions
  • Reduces confusion from outdated configuration documentation and stale environment variables
  • Establishes automated safeguards to maintain alignment between sample configuration and actual runtime requirements

Copilot AI review requested due to automatic review settings March 30, 2026 12:17
@github-actions
Copy link
Copy Markdown
Contributor

👀 Peer Review Required

Hi @AkramZaabi! This pull request does not yet have a peer review.

Before this PR can be merged, please request a review from one of your peers:

  • Go to the PR page and click "Reviewers" on the right sidebar.
  • Select a team member or contributor to review your changes.
  • Once they approve, this reminder will be automatically removed.

Thank you for contributing! 🎉

@github-actions github-actions Bot added the files-changed: 4 PR changes 4 files label Mar 30, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 30, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 139df52a-4946-4acb-9bb3-50008b2e655c

📥 Commits

Reviewing files that changed from the base of the PR and between 7a682c2 and b8daba2.

📒 Files selected for processing (4)
  • .env.sample
  • .github/copilot-setup-steps.yml
  • README.md
  • web/tests/test_env_sample.py

Walkthrough

This PR updates the development environment configuration and documentation baseline. Changes include restructuring .env.sample for a development-focused setup with local services and third-party integrations, updating server startup commands and email provider references, rewriting the README with a consolidated Quick Start workflow, and introducing a test module to validate .env.sample coverage against runtime dependencies.

Changes

Cohort / File(s) Summary
Configuration & Documentation
.env.sample, README.md, .github/copilot-setup-steps.yml
Updated environment configuration from production-oriented to development-focused defaults, with security settings (ALLOWED_HOSTS, CSRF_TRUSTED_ORIGINS), local services (Redis, cache, cookies), and third-party integrations. Rewrote README with consolidated Quick Start workflow, updated server startup command to uvicorn, and changed email provider from SendGrid to Mailgun with Slack fallback.
Testing
web/tests/test_env_sample.py
Added new test class validating .env.sample coverage by extracting variables from settings.py dependencies via regex patterns and checking for debug-related entries that should not be present.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

🚚 This Repository Is Moving

Hi @AkramZaabi, thank you for your contribution!

We are in the process of migrating most of the logic from this repository to our new repository: alphaonelabs/learn.

What this means for your PR

Please do not merge or continue work here. Instead:

  1. Review the alphaonelabs/learn repository and familiarize yourself with its tech stack.
  2. Adapt your changes to work with that codebase.
  3. Open a new Pull Request in alphaonelabs/learn.

This PR has been automatically closed. Once you have opened your PR in the new repository, feel free to reference it here.

Thank you for your understanding and continued support! 🙏

@github-actions github-actions Bot closed this Mar 30, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves contributor onboarding and configuration hygiene by updating setup documentation, refreshing .env.sample to match runtime configuration, and adding a regression test to keep environment variables aligned over time.

Changes:

  • Rewrites README.md setup flow with cross-platform steps and clearer ASGI/Uvicorn guidance.
  • Reworks .env.sample by removing stale flags and grouping runtime env vars with comments.
  • Adds a Django test to assert .env.sample covers env vars referenced by runtime settings.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
web/tests/test_env_sample.py Adds a regression test to ensure .env.sample stays aligned with runtime env var usage.
README.md Updates local dev setup instructions, ASGI/Uvicorn startup, admin URL notes, and common errors.
.github/copilot-setup-steps.yml Syncs Copilot setup steps with the updated recommended Uvicorn dev server flow.
.env.sample Updates and reorganizes sample environment variables to match current settings/runtime expectations.

Comment thread README.md
Comment on lines +27 to +28
git clone https://github.com/alphaonelabs/alphaonelabs-education-website.git
cd alphaonelabs-education-website
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README clone URL (alphaonelabs/alphaonelabs-education-website.git) and the suggested cd directory name don’t match other repository references in this repo (e.g., pyproject.toml uses the project name education-website, and multiple docs link to github.com/alphaonelabs/education-website). This inconsistency is likely to break onboarding instructions; please align the clone/cd commands with the canonical repo name used elsewhere in the project.

Suggested change
git clone https://github.com/alphaonelabs/alphaonelabs-education-website.git
cd alphaonelabs-education-website
git clone https://github.com/alphaonelabs/education-website.git
cd education-website

Copilot uses AI. Check for mistakes.
Comment thread README.md
python manage.py create_test_data
```
```bash
python web/master_key.py
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command to generate a messaging key uses python web/master_key.py, but earlier sections note that commands may be run via poetry run. If a contributor follows the poetry run approach without activating the venv, this command may run against the wrong interpreter and fail/miss dependencies. Consider using poetry run python web/master_key.py (or explicitly state it must be run inside the activated venv).

Suggested change
python web/master_key.py
poetry run python web/master_key.py

Copilot uses AI. Check for mistakes.
Comment on lines 127 to +134
name: "Run Development Server"
description: "Start the Django development server"
commands:
- "python manage.py runserver"
- "poetry run uvicorn web.asgi:application --host 127.0.0.1 --port 8000 --reload"
notes:
- "Server runs at http://localhost:8000"
- "Admin panel available at http://localhost:8000/admin"
- "Server runs at http://127.0.0.1:8000/en/"
- "Use Uvicorn for local WebSocket support"
- "Admin panel path is controlled by ADMIN_URL in .env"
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step’s description says “Start the Django development server”, but the command now starts Uvicorn (ASGI). Please update the name/description to reflect that this is an ASGI/Uvicorn startup step to avoid confusion when following the setup guide.

Copilot uses AI. Check for mistakes.
Comment thread .env.sample
SECRET_KEY=django-insecure-change-me

# Must be a valid Fernet key. Generate one with: python web/master_key.py
MESSAGE_ENCRYPTION_KEY=5ezrkqK2lhifqBRt9f8_dZhFQF_f5ipSQDV8Vzv9Dek=
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.env.sample currently ships a concrete MESSAGE_ENCRYPTION_KEY value. Because this key protects encrypted messaging data, providing a real (valid) key in-repo increases the risk that someone deploys with the sample key unchanged. Safer pattern is to leave it blank (or set an obvious placeholder) and document generating a per-environment key (settings.py already has a default generator).

Suggested change
MESSAGE_ENCRYPTION_KEY=5ezrkqK2lhifqBRt9f8_dZhFQF_f5ipSQDV8Vzv9Dek=
MESSAGE_ENCRYPTION_KEY=

Copilot uses AI. Check for mistakes.
if line.strip() and not line.lstrip().startswith("#") and "=" in line
}

referenced_variables = set(re.findall(r'env\.(?:str|bool|list)\("([A-Z0-9_]+)"', settings_source))
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The env var extraction regex misses env("VAR", ...) usages (e.g., the STRIPE_* settings in web/settings.py use env(...) rather than env.str(...)), so this test can pass even when .env.sample is missing variables that are actually required at runtime. Consider expanding the regex to include env\("..." calls (and ideally also env.db()/other helpers) so the alignment check is meaningful.

Suggested change
referenced_variables = set(re.findall(r'env\.(?:str|bool|list)\("([A-Z0-9_]+)"', settings_source))
referenced_variables = set(
re.findall(r'env\.(?:str|bool|list|int|float|db)\("([A-Z0-9_]+)"', settings_source)
)
referenced_variables.update(re.findall(r'env\("([A-Z0-9_]+)"', settings_source))

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 4 PR changes 4 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants