Hi, and welcome to my workshop! 😊
In this workshop, you will learn the basics of Django, and lots of other treats the python environment can provide.
Before we can start though, I need you to do something for me. You see, there are some tools I cannot install for you 😔 Please take a look at the list in prerequisites and install the required tools 🔧 The project was made primarily to run in docker, but is compatible with local setup aswell.
See prerequisites.
Locate directory you want to have the project, clone the project and navigate into it.
git clone [email protected]:emilte/django-workshop.git && cd django-workshop
These files configure the environment the code runs in.
After running these commands, I recommend taking a look at them.
- .vscode/settings.json contains configurations for VSCode.
- clean/.docker.env contains environment variables/secrets for your container named
clean
.- solution/.docker.env contains environment variables/secrets for the
solution
container.
cp .vscode/settings.default.json .vscode/settings.json
cp clean/.docker.example.env clean/.docker.env
cp solution/.docker.example.env solution/.docker.env
The workshop is setup with two docker containers I will reference throughout the workshop. One named clean
and another named solution
.
- The
clean
container is for the moment completely empty. This is where you will start your django project. - The
solution
container is fully spec'ed with most of the tools I like to use on my own projects. It serves as an inspiration during your tasks as well as giving you an instant feeling as to what Django can provide.
This command is expected to display errors for the
clean
container.
There isn't a project inside it yet, but you will make one pretty soon 😉
docker compose up
The solution
server is now running on http://localhost:8002.
You may browse the admin panel.
Credentials can be found in solution/.docker.env
This step is only to enhance the VSCode experience where it can recognise Django, enable formatter, linters etc.
cd solution
pipenv
will recognise dependencies automatically from Pipfile.
PIPENV_VENV_IN_PROJECT=1
will ensure that the environment is installed within this folder.
PIPENV_VENV_IN_PROJECT=1 pyenv exec pipenv install --dev --python 3.11
Cmd + Shift + P
--> Select interpreter
--> + Enter interpreter path
Write solution/.venv
and hit Enter
.
Go to documentation to continue with workshop.