8000 GitHub - jgarte/where-da-gas-at
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jgarte/where-da-gas-at

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

where da gas at?

run

start the backend

install the requirements

cd where-da-gas-at
pipenv install -r requirements.txt

create pyrightconfig.json and put the right content in it

pipenv --venv | xargs dirname
# /home/ozzloy/.local/share/virtualenvs

pipenv --venv | xargs basename
# where-da-gas-at-U7Wdii6-

cp example.pyrightconfig.json pyrightconfig.json
# modify the content to have the right content venv value
# venvPath should be the output of
#   pipenv --venv | xargs dirname
# and
# venv should be the output of
#   pipenv --venv | xargs basename

create .env

cp example.env .env

make sure its contents look right.

install postgres

postgres: create a user and db for this app

sudo -u postgres psql
CREATE USER where_da_gas_at WITH PASSWORD 'where da gas at?';
-- response: CREATE ROLE

CREATE DATABASE where_da_gas_at OWNER where_da_gas_at;
-- response: CREATE DATABASE

GRANT ALL PRIVILEGES ON DATABASE where_da_gas_at TO where_da_gas_at;
-- response: GRANT

-- switch to newly created db
\c where_da_gas_at
--You are now connected to database "where_da_gas_at" as user "postgres".

CREATE SCHEMA where_da_gas_at;

GRANT USAGE, CREATE
  ON SCHEMA where_da_gas_at
  TO where_da_gas_at;
-- GRANT

GRANT
  ALL PRIVILEGES
  ON ALL TABLES
  IN SCHEMA where_da_gas_at
  TO where_da_gas_at;
-- GRANT

\q
-- exit psql session

helpful psql tips

\l -- see existing dbs
\c where_da_gas_at -- connect to db
SET search_path TO where_da_gas_at; -- set schema
\dt -- list tables

-- "user" needs to be in quotes.  psql reserves 'user' sans quotes
select * from "user";

run the backend

# on new project creation,
pipenv run flask db init

# on every schema change
pipenv run flask db migrate -m "describe schema change"

pipenv run flask db upgrade
pipenv run flask seed all
pipenv run flask run

reset the backend

this will delete all the tables and re-add them

pipenv run flask db-drop-all
pipenv run flask db upgrade

and you can then reseed with

pipenv run flask seed all

nuke a postgres db

another option is to drop the db and recreate it

./reset-postgres.bash

start the frontend

cd where-da-gas-at/react-vite
npm i
npm run dev

which should produce output like this

8:22:39 PM [vite] warning: LintOnStart is turned on, and it will check for all matching files.
  Plugin: vite-plugin-eslint

  VITE v4.5.2  ready in 753 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help

test

test the backend

cd where-da-gas-at
pipenv run pytest

should produce output like this:

========================== test session starts =====================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0
rootdir: /home/ozzloy/app-academy/src/where-da-gas-at
collected 1 item

tests/api/test_auth_routes.py .                              [100%]

=========================== 1 passed in 0.14s ======================

deploy

TODO make sure these commands actually work

cd react-vite
npm run build
git add dist
git commit -m "add new dist for deployment"
git push

then do whatever on render.com, idk

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 45.7%
  • JavaScript 42.8%
  • CSS 9.8%
  • Shell 1.3%
  • Other 0.4%
0