- Consider setting up a virtual environment by using something like pipenv or virtualenv
- Install python version 3.6 or above
- https://www.python.org/
- Install version 3 of Django
- $ python -m pip install Django
- https://docs.djangoproject.com/en/3.0/topics/install/
- Install the latest version of Pillow
- $ python3 -m pip install --upgrade pip
- https://pillow.readthedocs.io/en/stable/installation.html
- Install Django crispy forms
- $ pip install django-crispy-forms
- https://django-crispy-forms.readthedocs.io/en/latest/install.html#installing-django-crispy-forms
- You can also optionally use our requirments.in file
- $pip install -r requirements.txt
- Clone project from repo
- Install Homebrew
- Install PostgreSQL
- $ brew install postgresql
- https://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/
- Start PostgreSQL database
- Open PostgreSQL command line tool
- $ psql
- Create a database called ‘mydb’
- # CREATE DATABASE mydb WITH OWNER [insert username here];
- Open PostgreSQL command line tool
- Install the PostgreSQL trigram extension
- psql
- Choose the database you want to install the extension for, in this case "mydb"
- # \c mydb
- istall the extension
- # CREATE EXTENSION pg_trgm;
- Install psycopg2
- $ pip install psycopg2-binary
- https://www.psycopg.org/docs/install.html
- Connect the Django project to the PostgreSQL database
- Export your database username as a local variable
- $ export mydb_USER=[insert username here]
- Export your database password as a local variable
- $ export mydb_PASSWORD=[insert password here]
- Export your database username as a local variable
- Delegate an email as the orgnization email
- Export an email as a local variable
- $ export TEXTBOOK_SWAP_EMAIL_USER=[insert email here]
- Export the app password as a local variable
- $ export TEXTBOOK_SWAP_EMAIL_PASS=[insert app password here]
- Export an email as a local variable
- Create the necessary migration files
- $ python3 manage.py makemigrations
- Perform the migrations
- $ python3 manage.py migrate
- Create super user
- $ python3 manage.py createsuperuser
- follow the prompt
- [OPTIONAL] create instances
- run the django shell
- $ python3 manage.py shell
- create randomized user and post instances
- \
python from createInstances import reinitialize as re re() \
- \
- create real book instances
- \
python from createInstances import createRealInstances as cri cri() \
- \
- run the django shell
- Start the server
- $ python3 manage.py runserver
- [OPTIONAL] view webpage on mobile device
- from (https://stackoverflow.com/questions/42451790/accessing-django-localhost-server-through-lan/42451833)
- run python manage.py runserver 0.0.0.0:8000
- figure out your ip address, which coud look something like say ~ "192.168.1.8"
- Add your ip address to the ALLOWED_HOSTS list in your settings.py file.
- connect your mobile device to the same network as your server
- access the web page on your device by using a url of the form [Ip Adress]:8000. For example 192.168.1.8:8000 on our case.
- from (https://stackoverflow.com/questions/42451790/accessing-django-localhost-server-through-lan/42451833)