This is a starter project for you to use to start your Python database projects.
There are two videos to support:
; git clone git@github.com:makersacademy/databases-in-python-project-starter.git YOUR_PROJECT_NAME
Or, if you don't have SSH keys set up
; git clone https://github.com/makersacademy/databases-in-python-project-starter.git YOUR_PROJECT_NAME
; cd YOUR_PROJECT_NAME
; python -m venv databases-starter-venv
; source databases-starter-venv/bin/activate
(databases-starter-venv); pip install -r requirements.txt
Read below if you see an error with
python_full_version
(databases-starter-venv); createdb YOUR_PROJECT_NAME
YOUR_PROJECT_NAMEcan be anything you want it to be
On line 11 of lib/database_connection.py you'll find this...
DATABASE_NAME = "DEFAULT_MAKERS_PROJECT" # <-- CHANGE THIS!
Change DEFAULT_MAKERS_PROJECT to whatever you chose for YOUR_PROJECT_NAME
(databases-starter-venv); pytest
If the tests fail, see below
(databases-starter-venv); python app.py
I get a ModuleNotFoundError: No module named 'psycopg'
If, after activating your
venv and installing dependencies, you see this error when running pytest, please deactivate and reactivate your venv. This should solve the problem - if not, contact your coach.
The tests fails and I see Exception: Couldn't connect to the database DEFAULT_MAKERS_PROJECT!
This error most likely means you need to edit line 11 in
lib/database_connection.py. Go there and change "DEFAULT_MAKERS_PROJECT" to the name of the database you created in step 6.