Skip to content

pyOpenSci/pyopensci-django

pyopensci-django

A repository to migrate the pyOpenSci Jekyll site to Django with Wagtail CMS.

All Contributors

Prerequisites

Before setting up the project locally, make sure you have the following installed:

  • First, install uv - Install uv
  • Then make sure you have Python 3.12+ installed. You can install it using uv:
$ uv python install 3.12

Local Development Setup

1. Set Up Python Environment with uv

# Install all dependencies and create virtual environment
uv sync

# Install Node.js packages for TailwindCSS
npm install

If you are running a development server locally and you have set things up previously, you may want to delete your existing database and start from scratch. To do this, delete the db.sqlite3 file in the project root:

rm db.sqlite3

2. Build CSS and Set Up Database

# Build TailwindCSS stylesheets
npm run build-prod

# Run migrations using uv
uv run python manage.py migrate

3. Create an admin user (optional)

If you want to try out the Django Admin dashboard or Wagtail dashboard, create a superuser (admin) account which can be used for Django Admin and Wagtail:

# Create superuser (optional - for admin access)
uv run python manage.py createsuperuser

4. Generate Test Data (optional but recommended)

To see how blog and events pages look with content, generate dummy blog posts and events:

# Generate default test data (25 blog posts, 20 events)
uv run python manage.py create_dummy_posts

# Or specify custom amounts
uv run python manage.py create_dummy_posts --blog-posts=30 --events=25

# Delete any existing dummy data
uv run python manage.py create_dummy_posts --delete

This command creates:

  • Blog posts distributed across multiple years (for testing the drop down, year filters)
  • Events with both past and upcoming dates
  • Random tags, authors, and excerpts
  • All posts are automatically published and visible

5. Run Development Server

# Start Django development server
uv run python manage.py runserver

Available Pages

Running Tests

# Run all tests
uv run python manage.py test

# Run tests with verbose output (shows each test name)
uv run python manage.py test -v 2

# Run tests with coverage
uv run coverage run --source='.' manage.py test
uv run coverage report

# Generate HTML coverage report
uv run coverage html

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Philip Narteh
Philip Narteh

💻 👀

This project follows the all-contributors specification. Contributions of any kind welcome!

About

A repository to test out a django site for pyOpenSci

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5