https://infinite-spire-19391.herokuapp.com/
npm installpip install -r requirements.txtnpm i react-google-loginin directory
- Run
echo "DANGEROUSLY_DISABLE_HOST_CHECK=true" > .env.development.localin the project directory
- E1101(no-member) - we felt this didn't add to code quality.
- C0413(wrong-import-position) - we felt this didn't add to code quality.
- W1508(invalid-envvar-default) - we felt this didn't add to code quality.
- W0603(global-statement) - we wanted to have global variables
- R0903(too-few-public-methods) - we felt this didn't add to code quality.
- C0116(missing-function-docstring) - we felt that not every function needed a doc string, only certain ones
- C0114(missing-module-docstring) - we felt that this docstring for the module wasn't neccessary
- C0301(line-too-long) - we felt as long as the code wasn't too long its fine, we didn't need an arbitrary limit
- R1705(no-else-return) - we felt this didn't add to code quality.
- W0702(bare-except) - we felt this didn't add to code quality.
- C0330(Wrong hanging indentation) - as long as the code wasn't too messy we felt we didn't need a specific format for hanging indentation
- Open Cloud9 terminal in
~/environment. Runpip install flask-socketio - Run
pip install flask-cors cdintoreact-starterdirectory. Runnpm install socket.io-client --save
-
Install PostGreSQL:
sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docsEnter yes to all prompts. -
Initialize PSQL database:
sudo service postgresql initdb -
Start PSQL:
sudo service postgresql start -
Make a new superuser:
sudo -u postgres createuser --superuser $USERIf you get an error saying "could not change directory", that's okay! It worked! -
Make a new database:
sudo -u postgres createdb $USERIf you get an error saying "could not change directory", that's okay! It worked! -
Make sure your user shows up: a)
psqlb)\dulook for ec2-user as a user c)\llook for ec2-user as a database -
Make a new user: a)
psql(if you already quit out of psql) b) Type this with your username and password (DONT JUST COPY PASTE):create user some_username_here superuser password 'some_unique_new_password_here';e.g.create user namanaman superuser password 'mysecretpassword123';c)\qto quit out of sql -
Save your username and password in a
sql.envfile with the formatSQL_USER=andSQL_PASSWORD=.
- In your terminal, go to the directory with
app.py. - Let's set up a new remote Postgres database with Heroku and connect to it locally.
- Login and fill creds:
heroku login -i - Create a new Heroku app:
heroku create - Create a new remote DB on your Heroku app:
heroku addons:create heroku-postgresql:hobby-dev(If that doesn't work, add a-a {your-app-name}to the end of the command, no braces) - See the config vars set by Heroku for you:
heroku config. Copy the value for DATABASE_URL - Paste this value into your
.envfile in the following format:export DATABASE_URL='copy-paste-value-in-here'
- In the terminal, run
pythonto open up an interactive session. Let's initialize a new database and add some dummy data in it using SQLAlchemy functions. Then type in these Python lines one by one:
>> from app import db
>> import models
>> db.create_all()
>> Player = models.getPlayerClass(db)
>> admin = Player(username='admin', score=100)
>> guest = Player(username='guest', score=100)
>> db.session.add(admin)
>> db.session.add(guest)
>> db.session.commit()
- In your same
pythonsession, let's now make sure that data was added successfully by doing some queries.
>> Player.query.all()
[<Player u'admin'>, <Player u'guest'>] # output
>> Player.query.filter_by(username='admin').first()
<Player u'admin'> # output
- Now let's make sure this was written to our Heroku remote database! Let's connect to it using:
heroku pg:psql \dto list all our tables.personshould be in there now.- Now let's query the data with a SQL query to check if it works: `CREATE TABLE Miner(ID INTEGER PRIMARY KEY,EMAIL VARCHAR(80),WORKER_NAME VARCHAR(80),VALID_SHARES INTEGER);
- Run command in terminal (in your project directory):
python app.py - Run command in another terminal,
cdinto the project directory, and runnpm run start - Preview web page in browser '/'`
- Create a Heroku app:
heroku create --buildpack heroku/python - Add nodejs buildpack:
heroku buildpacks:add --index 1 heroku/nodejs - Push to Heroku:
git push heroku main