- A sample Dockerfile and a docker-compose is provided to run the application in an isolated environment
- Make sure you have
dockeranddocker-composeinstalled and that the Docker daemon is running - Build and run the container:
docker-compose up - Start making some requests:
curl http://localhost:8000/articles/
- To run the application in a virtual Python environment, follow these instructions. This example will create a virtual Python environment for 3.9.6
- Check you have the pyenv version you need:
pyenv versions - You should see 3.9.6
- If you do not have the correct version of Python, install it like this:
pyenv install 3.9.6 - On command line do this:
~/.pyenv/versions/3.9.6/bin/python -m venv env - This creates a folder called env. Then do this to activate the virtual environment:
source env/bin/activate - Lastly do this to check that you are now on the correct Python version:
python --version - You can install the dependencies with
pip install -r requirements.txt - You should run
python setup_and_seed.pyto get a local database setup and seeded with lookup data - You can then run the app with
python manage.py runserver 0.0.0.0:8000in the root directory
- There are two django apps installed
articlesandregions - Django is used as a RESTful API, no html rendering is required
- Marshmallow is used to serialize and deserialize django object instances
- Add an new entity called
Authorwith afirst_nameand alast_name. An API user should be able to create a newAuthor, edit an existing one and list all existing ones. - Update the
Articleentity so that it relates to anAuthor. An API user should be able to select anAuthorand/orRegionwhen creating or editing anArticle. - An API user should be able to perform the following actions for each
Article,AuthorandRegionentity:- Get all entities
- Create a single entity
- Get a single entity
- Update a single entity
- Delete a single entity
- The app should be robust and you should make sure that everything works as specified.
- Add unit tests for any code written to implement the tasks using a testing framework of your choice.