Skip to content

Development

Tim Nelson edited this page Oct 5, 2020 · 21 revisions

Development

Please ensure development is done within a virtual environment, whether locally or on Gitpod.

Our current preference is to have contributors work directly in Gitpod, to avoid any possible implications that may arise from not using a virtual environment.

Open in Gitpod

In order to run this project locally on your own system, you will need the following installed (as a bare minimum):

Next, there's a series of steps to take in order to proceed with local deployment:

  • Clone this GitHub repository by downloading the project as a zip-file (remember to unzip it first), or by entering the following command into the Git CLI terminal:
    • git clone https://github.com/Code-Institute-Community/ci-hackathon-app.git
  • Navigate to the root directory after unpacking the files.
    • cd <path to root directory>
  • Create a .env file with the specified variables.
    • touch .env
    • View our example .env_sample file for reference.
  • Install all requirements from the requirements.txt file:
    • pip3 install -r requirements.txt
  • Launch the Django project:
    • python3 manage.py runserver
  • The Django server should be running (either locally, or on Gitpod).
  • When you run the Django server for the first time, it should create a new SQLite3 database file: db.sqlite3
  • Stop the app with CTRL+C, and make sure you checkout into an appropriate branch. Never develop or attempt to push onto the master branch; this will be rejected.
    • git branch -a (view existing branches)
    • git checkout -b new_branch_name (create new branch)
    • git checkout branch_name (checkout to existing branch)
  • Make sure to pull any updates from the master branch onto the current branch:
    • git pull origin master
  • Next, you will need to make migrations to create the database schema:
    • python3 manage.py makemigrations
    • python3 manage.py migrate
  • In order to access the Django Admin Panel, you must generate a superuser:
    • python3 manage.py createsuperuser
    • (assign your own admin username, email, and secure password)
  • Launch the Django project once again:
    • python3 manage.py runserver

Once the database migrations and superuser have been successfully completed, Django should migrate the existing migrations.py files from each app to configure the following relational schema:

(NOTE: this is not the actual schema yet, and will be updated soon.)

flow-chart

  • Once you're happy with all changes, you can commit and push your code to the appropriate branch:
    • git add <files>
    • git commit -m "Your commit message"
    • git push origin <BRANCH_NAME>
    • reminder: do not attempt to push to the master branch!
  • Finally, you will need to open a Pull Request on GitHub, detailing all required information:
    • If you've added code that should be tested, please attempt to add the required tests.
    • Make sure you address any known issues/bugs/warnings/errors.
    • If you make visual changes, please include tested screenshots.
    • If you make any existing code better, please let us know in your PR description.
    • Assign yourself as the Assignee on the PR.
    • Assign the help wanted label to your PR.
    • Assign the appropriate Project to your PR.
    • If contributing to specific User Stories, please be sure to include the appropriate User Story ID.
      • #M01 (Miscellaneous User Story #01)
      • #P02 (Participant User Story #02)
      • #S03 (Staff User Story #03)
      • #A04 (Admin User Story #04)

Happy Coding, and thanks for Contributing to the Code Institute Community!

Additional Resources

Working with a forked repo

Clone this wiki locally