Tags
I have no experience in django, and in my exploration to become a better python developer I am dipping my toe into one of the most polished and widely used web frameworks Django to so that I can better understand it and become a better python developer.
If you found this at all helpful make sure you check out the django tutorial
install django
The first thing I need to do is render out a template to start the project.
For this I need the django-admin
cli. To get this I am going the route of
pipx
it will be installed globally on my system in it's own virtual
environment that I don't have to manage. This will be useful only for using
startproject as far as I know.
pipx install django django-admin startproject try_django cd try_django
Make a venv
Once I have the project I need a venv for all of django and all of my
dependencies I might need for the project. I have really been diggin hatch
lately, and it has a one line "make a virtual environment and manage it for
me" command.
hatch shell
If hatch is a bit bleeding edge for you, or it has died out by the time you read this. The ol trusty venv will likely stand the test of time, this is what I would use for that.
python -m .venv --prmpt `basename $PWD` . ./.venv/bin/activate
Start the webserver
Next up we need to start the webserver to start seeing that development content. The first thing I did was run it as stated in the tutorial and find it clashed with a currently running web server port.
python manage.py runserver
I jumped over to that tmux session, killed the process and I was up and running.
What's running
The default django hello world looks well designed. You are first presented with this page.
Next
I opened up the urls.py
to discover that the only configured url was at
/admin
. I tried to log in as admin, but was unable to as I have not yet
created a superuser. Next time I play with django that is what I will explore.