This is the backend for a photo storage/filter app
-
Create virtual environment and activate
python3 -m venv venv source venv/bin/activate
-
Install dependencies
pip3 install -r requirements.txt
-
Create a new PostgreSQL database
createdb pixly
-
Set up AWS:
Create a free AWS account at https://aws.amazon.com/
Create a new S3 bucket
Under permissions, add the following to bucket policy:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::[remove brackets and replace with your bucket name]*" } ] }
Permissions should be:
-Access: public
-Block all public access: off
-Object ownership: Bucket owner enforced -
Create a file named .env and add environment variables with values from your AWS account:
AWS_ACCESS_KEY_ID=*add your value here* AWS_SECRET_ACCESS_KEY=*add your value here* BUCKET_NAME=*add your value here* REGION=*add your value here*
-
Create the database tables
Run IPython:ipython
In IPython:
%run app.py db.create_all()
-
To start server:
python3 -m flask run -p 5000 (or 5001 if on newer mac)
-
Refer to instructions for front end at https://github.com/evanhesketh/pix.ly-frontend