Skip to content

mgjeffries/WhoYou-Server

Repository files navigation

WhoYou-Server

This is a learning project. The goal was to address redundant data entry by providing an app where users an manage their own content

The live site can be viewed at https://whoyou-client.herokuapp.com/login

The client code can be found at https://github.com/mgjeffries/whoyou-client

The server is hosted at: mgjeffries.pythonanywhere.com until 7 April 2021.

Running the server locally

Dependencies: Python 3.8

  1. Clone the repo: git clone https://github.com/mgjeffries/WhoYou-Server
  2. Activate the virtual environment: pipenv shell
  3. Install the dependencies for the virtual environment: pipenv install
  4. Setup the database from the fixtures by running the seed file sh seed.sh
  5. Run the server python manage.py runserver

Test the Code

Integrations tests are the best! Run them before you create a pr. Run them before you deploy! Run them when you wake up, or go to bed, or whenever you want!

  1. run python manage.py test tests -v 1

Deploying changes to the "production server"

  1. If new packages have been installed in the pipenv, run pipenv lock -r > requirements.txt to save these dependencies to the virtual environment
  2. Push your changes to github, create a pr, and after approval, it will be the new main branch
  3. Log into pythonAnywhere, open the bash script for whoYou, and git pull origin main to get the changes
  4. If changes have been made to the dependencies, run pip install -r requirements.txt , note that the server uses a different virtual environment(virtualenv instead of pipenv. This should already be running.)
  5. Reload the web app: In pythonanywhere, navigate to the webapp, and click the big green button that says reload web app

FYI, the server has a custom wsgi config file. Here is a copy for reference:

# +++++++++++ DJANGO +++++++++++
# To use your own django app use code like this:
import os
import sys

# assuming your django settings file is at '/home/mgjeffries/mysite/mysite/settings.py'
# and your manage.py is is at '/home/mgjeffries/mysite/manage.py'
path = '/home/mgjeffries/WhoYou-Server'
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'whoYouServer.settings'

# then:
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Releases

No releases published

Packages

No packages published