Clone this repo - Note: I have named the directory animal-adoption-app for consistency but you can name it whatever you like!
git clone https://github.com/Matt-Wilkes/python-react-animal-adoption-app.git animal-adoption-app
cd animal-adoption-appcd frontend
npm installThis will live in a folder called 'server' just under the root.
cd serverpython -m venv animal-adoption-app-venv
source animal-adoption-app-venv/bin/activate pip install -r requirements.txtIn the terminal:
cd db
createdb animal_adoption_appIn a new terminal: Generate a secret key in Python repl:
python
import secrets
print(secrets.token_hex(32)) # copy the secret key generated here
exit()# create a .env file with your secret key in the same directory (server)
echo SECRET_KEY=\"ReplaceThisWithYourSecretKey\" >> .env
# check the .env file has been created and updated with your secret key
open .envNODE_ENV="development" DATABASE_CONNECT = "postgresql://your-user-name@localhost:5432/animal_adoption_app" DATABASE_NAME = "animal_adoption_app" DATABASE_HOST = "localhost" PHOTO_UPLOAD_LOCATION = "static/photo_uploads/"
The /frontend/.env file contains a link to the server which will provide the underlying API services. You'll need to repoint this to your flask server.
in the /frontend directory
# create the .env file
echo VITE_BACKEND_URL="http://127.0.0.1:5000" >> .env
# check the .env file has been created and updated with your secret key
open .envin the server/ directory run the below commands
flask init-db
flask seed-db- run this file : python print_seed.py
You'll need to run the server in one terminal and the frontend in another terminal window
cd server
python -m flask runcd frontend
npm run dev