I 💛 the Django Girls Tutorial. After following it, I continued the fun by:
- Install the version of Python the .tool-versions file.
- You may want to use asdf for this purpose.
- Make sure you have GNU Make installed on your machine.
- A Makefile was added to the project to simplify some tasks.
-
The project uses pipenv to manage the Python dependencies and facilitate the workflow when working with a virtualenv. You'll need to install pipenv before getting started.
-
Setup dev environment:
make dev_setup- Make sure things are healthy by running the tests:
make test- Start the server:
make runserverThe tests that are run as part of CI are:
tests.formstests.modelstests.viewstests.functional: these are run as E2E tests with Selenium and Firefox in headless mode.
You can run all of these tests with: make test or with the following command:
python manage.py test tests.forms tests.models tests.views tests.functionalYou can pass the module or test case:
python manage.py test <module_pattern> For example, to run all the tests in the models module:
python manage.py test tests.modelsAnd you can also use the --pattern or -p argument. For example:
python manage.py test --pattern="*_forms.py"python manage.py test -p "*_forms.py"You can get more details about the test execution by passing the argument --verbosity or -v. For the value you can choose from: 0, 1, 2, 3.
For example, to pass verbosity of 2:
python manage.py test tests.functional -v 2make test_coveragecoverage html -d coverage-reportE2E Tests that open a visible browser are currently run separately from the rest of the tests. To run them, make sure you have Firefox installed and run:
make test_e2eE2E tests use the shared Firefox WebDriver factory in tests/webdriver.py.
If Firefox is installed in a non-standard path, set FIREFOX_BINARY before running the tests.
export FIREFOX_BINARY=/path/to/firefoxA visual demo of the blog, implemented with SeleniumBase can be run with:
make rundemoℹ️ The development server needs to already be running and a superuser needs to also exist with credentials that need to be exposed as environment variables:
export MY_BLOG_USERNAME=myusername
export MY_BLOG_PASSWORD=mypasswordThis work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
The tutorial that was followed for the creation of this blog is attributed to Django Girls and it can be found here.
