Getting a project up and running#

I had an interesting conversation this morning with Bob from Pybites. He was able to confirm what I’d been musing over the past few days. It was time I started working on some projects. In that spirit, I decided to jump into the Educative learning path Become a Django Developer. First off, it drops you straight in with no install instructions. I’ve played with poetry before so I decided to go that route to manage any dependencies and virtual environments that I might need.

Useful tip: At the time of writing this and using django4 the startproject.

I set up Postgres in my local machine using brew, created a user and password,and connected my django install to a new database created for that purpose. Not a bad hour.

If in doubt, the next few hours were not so easy. The Eduactive learning path doesn’t go into any details on installing Django. (let the fun begin. I set it up in poetry and getting any of the commands, such as python manage.py makemigrations to run took me some time to get me head around. All the commands in the tutorial need to be run with the prefix of poetry run.

So, far so good. But the tutorial recommends using PostgreSQL as the database type. Queue install PostgreSQL.app, test it, find it in compatible with the instructions I’m finding online to set up a new user, remove it. (somewhat complicated), install using brew and then get it up and running and create a new user, so as not to use my Mac login and password.

Ok, then the problems started. I altered the settings.py of my Django project to reflect the PostreSQL choice and boom, everything I tried kept referring me to the DJANGO_SETTINGS_MODULE. I had added the project name here, tried it without a final comma, (but this seems to be a Black formatting step. Deleted the git repo, the local files and started again.

I repeated all the steps, this time following another web page, read up on some Django documentation and after much ado ended up exactly where I had been two hours earlier.

So what was the problem?#

Essentially, I had left the BASE_URL setting in place for the PostgreSQL database path. This is not necessary for PostgreSQL. Yep, that did it. With that gone, it was sweet running.

So far, I have a running Django (empty) app on my local machine, and possibly running on a PostgreSQL database.

Only five hours.

Now to get it all committed to the new repo. And see what step two in the Educative course is.