Skip to content

Latest commit

 

History

History
116 lines (71 loc) · 3.64 KB

Contributing.md

File metadata and controls

116 lines (71 loc) · 3.64 KB

Savior19

Setting up

  • Create a fork of the project by clicking the fork button, and then go to your fork.
# Clone it (in an appropriate location in your computer).
$ git clone [path_to_your_fork]

# Change directory
$ cd Savior19

# Add the upstream repo
$ git remote add upstream https://github.com/Savior-19/Savior19.git

# Check if it has been added properly
git remote -v
  • The next few commands can be used to update your local copy and your fork whenever there is an update in the upstream repository.
# Get the latest upstream changes
$ git fetch upstream

# Switch to the Master branch
$ git checkout master

# Merge the upstream/GraphQL branch with your local GraphQL branch
$ git rebase upstream/master master

# Push the upstream changes to your fork
$ git push origin master
  • Setup and activate a python virtual environment (perferrably in a folder outside your project and this is not a mandatory step).
# Creating a virtual environment.
$ virtualenv -p python3 venv

# Activating the virtual environment (Has to be run everytime we execute the project).
$ source venv/bin/activate
  • Install the required packages and dependencies.
# If you do not have pip installed, then first install it and proceed.
$ pip install -r requirements-dev.txt
  • Create a .env file to store all your environment variables for the project.

Running the Django Project

# To make migrations :
$ python manage.py makemigrations

# To migrate to the database :
$ python manage.py migrate

# To create a super user (to be run only during the creation of the database)
$ python manage.py createsuperuser

# To run the application :
$ python manage.py runserver

Submitting Changes

  • After pushing your changes to the orgin of the forked repository, create a merge request to the main repository's master branch.

Instructions

  • All the html files for the corresponding applications should be kept under its respective folder under the 'templates' folder.
  • All the css and styling for the corresponding applications should be maintained under its respective folder under the 'static/css' folder.
  • All the external javascript files for the corresponding applications should be maintained under its respective folder under the 'static/js' folder.
  • The home page for the project will be maintained under the 'Savior19' folder which is the main project folder, all other pages will be maintained under their respective applications.

Additional Details

  • There are two branches in this repository, (master and deploy). The 'deploy' branch has a pipeline straight from github to heroku to get it deployed automatically. All the changes from the developers side wil be done to the master branch and when we want to deploy it, we should merge the 'master' branch to the 'deploy' branch
  • In our 'settings.py' file there is an option of 'DEPLOY', this is by default set to 'True' in the deploy branch and 'False' in the master branch. When this is set to 'True', the settings are changed to suit for deployment.
  • If we need to deploy the project with 'DEBUG' as 'False' in our local environment then we should first execute 'python manage.py collectstatic' and then run the server. While executing this command django will load all the static files into the 'staticfiles' directory for it to load during deployment.

Heroku Deployment

# To login :
$ heroku login

# To view list of all available apps :
$ heroku apps

# To Run any Django command :
$ heroku run <Django Command> -a <Heroku application name>
Eg:  $ heroku run python manage.py createsuperuser -a savior19-staging