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.
- BaseURL - https://blog-cms-django-abaff6e17c2a.herokuapp.com/api/
/blogs/- user blogs/featured-articles/- a collection of articles selected by website editors/rss-feeds/- user RSS feeds/users/- user id
- Install Docker and Docker VS Code extension
- Reopen the repo in the docker container using Dockerfile
- 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 - CMS will be running at http://localhost:8000/admin/. API can be accessed at http://localhost:8000/api/.
-
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
-
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-rmautomatically removes the container after it stops.
Contact Lulu Cao for access to heroku app.
git push
git push heroku
- Pytest-Django Official Documentation
- Testing Your Django App With Pytest, pay special attention to
Testing Django REST Framework with Pytest - How to Provide Test Fixtures for Django Models in Pytest
- Running Unit Tests With Docker
- How to run PyTest in docker container, this article also provides an example workflow yml for GitHub Actions