Skip to content

charlescook10/book-store-databases-in-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Database Project Starter

This is a starter project for you to use to start your Python database projects.

There are two videos to support:

Setup

1. Clone the repository to your local machine

; 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

2. Enter the directory

; cd YOUR_PROJECT_NAME

3. Set up the virtual environment

; python -m venv databases-starter-venv

4. Activate the virtual environment

; source databases-starter-venv/bin/activate 

5. Install dependencies

(databases-starter-venv); pip install -r requirements.txt

Read below if you see an error with python_full_version

6. Create the database

(databases-starter-venv); createdb YOUR_PROJECT_NAME

YOUR_PROJECT_NAME can be anything you want it to be

7. Change DATABASE_NAME to equal YOUR_PROJECT_NAME

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

8. Run the tests - see below if you have any issues

(databases-starter-venv); pytest

If the tests fail, see below

9. Run the app

(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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6

Languages