Skip to content

lulu-cao/blog-cms-django

Repository files navigation

Blog Admin

This is the CMS and API for Blog. Access the backend admin site at https://blog-cms-django-abaff6e17c2a.herokuapp.com/admin. Contact Lulu Cao for login information.

API Structure

Development

  1. Install Docker and Docker VS Code extension
  2. Reopen the repo in the docker container using Dockerfile
  3. Install dependencies, apply database migrations, and start the app
    pipenv shell
    pipenv install
    pipenv run python manage.py migrate
    pipenv run python manage.py runserver
    pipenv run python manage.py createsuperuser
    
  4. CMS will be running at http://localhost:8000/admin/. API can be accessed at http://localhost:8000/api/.

Tests

  1. To run tests in the current Docker container, use a command from below:

    pytest                                                   # all 
    pytest a_directory                                       # directory
    pytest test_something.py                                 # tests file
    pytest test_something.py::single_test                    # single test function
    pytest -m "xfail and not slow" --strict-markers          # tests with Marks
  2. To run tests in a separate Docker container, build a new Dcoker image with the tag django-tests.

    docker build -f Dockerfile.test -t django-tests .
    

    Then start a Docker container based on the previously built image.

    docker run --rm django-tests
    

    -rm automatically removes the container after it stops.

Deployment

Contact Lulu Cao for access to heroku app.

git push
git push heroku

Useful Documentation

Pytest

  1. Pytest Official Documentation
  2. Effective Python Testing With Pytest

Pytest-Django

  1. Pytest-Django Official Documentation
  2. Testing Your Django App With Pytest, pay special attention to Testing Django REST Framework with Pytest
  3. How to Provide Test Fixtures for Django Models in Pytest

Docker

  1. Running Unit Tests With Docker
  2. How to run PyTest in docker container, this article also provides an example workflow yml for GitHub Actions

About

Platform for RSS reading and personal blogging (Backend - Django)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors