|
27 | 27 | Routes are defined in `/pennlabs/urls.py` and subsequent app folders in the form of `*/urls.py`. Account/authorization related scripts are located in `accounts/` and Penn Labs related scripts are located in `org/`. |
28 | 28 |
|
29 | 29 | Documentation about individual endpoints is available through the `documentation/` route when the Django app is running. |
| 30 | + |
| 31 | +## Installation |
| 32 | +You will need to start both the backend and the frontend to do Platform development. |
| 33 | + |
| 34 | +### Backend |
| 35 | + |
| 36 | +Running the backend requires [Python 3](https://www.python.org/downloads/). |
| 37 | + |
| 38 | +To run the server, `cd` to the folder where you cloned `penn-clubs`. Then run: |
| 39 | +- `cd backend` |
| 40 | + |
| 41 | +Setting up `psycopg2` (this is necessary if you want to be able to modify |
| 42 | +dependencies, you can revisit later if not) |
| 43 | + |
| 44 | +- Mac |
| 45 | + - `$ brew install postgresql` |
| 46 | + - `$ brew install openssl` |
| 47 | + - `$ brew unlink openssl && brew link openssl --force` |
| 48 | + - `$ echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc` |
| 49 | + - `$ export LDFLAGS="-L/usr/local/opt/openssl@3/lib"` |
| 50 | + - `$ export CPPFLAGS="-I/usr/local/opt/openssl@3/include"` |
| 51 | +- Windows |
| 52 | + - `$ apt-get install gcc python3-dev libpq-dev` |
| 53 | + |
| 54 | +Now, you can run |
| 55 | + |
| 56 | +- `$ pipenv install` to install Python dependencies. This may take a few |
| 57 | + minutes. Optionally include the `--dev` argument if you are installing locally |
| 58 | + for development. If you skipped installing `psycopg2` earlier, you might see |
| 59 | + an error with locking -- this is expected! |
| 60 | +- `$ pipenv shell` |
| 61 | +- `$ ./manage.py migrate` OR `$ python3 manage.py migrate` |
| 62 | +- `$ ./manage.py populate_users` OR `$ python3 manage.py populate_users` (in development, |
| 63 | + to populate the database with dummy data) |
| 64 | +- `$ ./manage.py runserver` OR `$ python3 manage.py runserver` |
| 65 | + |
| 66 | +### Frontend |
| 67 | + |
| 68 | +Running the frontend requires [Node.js](https://nodejs.org/en/) and [Yarn](https://yarnpkg.com/getting-started/install). |
| 69 | + |
| 70 | +You will need to set the following environment variables on the frontend: |
| 71 | +- `NEXT_PUBLIC_GOOGLE_API_KEY` |
| 72 | +- `NEXT_PUBLIC_SITE_NAME` (Optional) |
| 73 | + - Specify `clubs` to show Penn Clubs and `fyh` to show Hub@Penn. |
| 74 | + |
| 75 | +1. Enter the `frontend` directory with a **new terminal window**. Don't kill your backend server! |
| 76 | +2. Install dependencies using `yarn install` in the project directory. |
| 77 | +3. Run application using `yarn dev`. |
| 78 | +4. Access application at [http://localhost:3000](http://localhost:3000). |
| 79 | + |
| 80 | +### Development |
| 81 | + |
| 82 | +Click `Login` to log in as a test user. The `./manage.py populate_users` command creates a test user for you with username `bfranklin` and password `test`. Go to `/api/admin` to login to this account. |
0 commit comments