Skip to content

Development

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

Development

IMPORTANT!

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.

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 development:

  1. Create a .env file with the specified variables.
    • touch .env
    • View our example .env_sample file for reference.
  2. Install all requirements from the requirements.txt file:
    • pip3 install -r requirements.txt
  3. Make sure to checkout into an appropriate branch. Never develop onto the master branch.
    • git branch -a (view existing branches)
    • git checkout -b new_branch_name (create new branch)
    • git checkout branch_name (go to an existing branch)
  4. Ensure that you have both origin and upstream remotes on your forked project.
    • git remove -v (view the remotes)
  5. Pull any updates from the master upstream branch, onto your current branch:
    • git pull upstream master
  6. Launch the Django project:
    • python3 manage.py runserver
  7. The Django server should be running (either locally, or on Gitpod).
  8. When you run the Django server for the first time, it should create a new SQLite3 database file: db.sqlite3
  9. Next, you will need to make migrations to create the database schema:
    • CTRL+C (stop the app)
    • python3 manage.py makemigrations
    • python3 manage.py migrate
  10. 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)
  11. 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 schema:

Hackathon ERD

User (django.contrib.auth)

id: <IntegerField> (PK)
username: <CharField> (UNIQUE)
email: <CharField>
first_name: <CharField>
last_name: <CharField>
is_staff: <BooleanField>
is_superuser: <BooleanField>

Hackathon (models.Model)

id: <IntegerField> (PK)
created: <DateTimeField>
updated: <DateTimeField>
created_by: User (FK)
display_name: <CharField>
description: <TextField>
start_date: <DateTimeField>
end_date: <DateTimeField>
awards: HackAwardCategory (FK)
teams: HackTeam (FK)
judges: User (FK)
organizer: User (FK)

HackTeam (models.Model)

id: <IntegerField> (PK)
created: <DateTimeField>
updated: <DateTimeField>
created_by: User (FK)
display_name: <CharField>
participants: User (FK)
project: Project (FK)

HackProject (models.Model)

id: <IntegerField> (PK)
created: <DateTimeField>
updated: <DateTimeField>
created_by: User (FK)
display_name: <CharField>
description: <TextField>
githubLink: <CharField>
collabLink: <CharField>
submissionTime: <DateTimeField>
scores: HackProjectScore (FK)
mentor: User (FK)

HackProjectScore (models.Model)

id: <IntegerField> (PK)
created: <DateTimeField>
updated: <DateTimeField>
created_by: User (FK)
judge: User (FK)
score: HackProjectScoreCategory (FK)

HackProjectScoreCategory (models.Model)

id: <IntegerField> (PK)
created: <DateTimeField>
updated: <DateTimeField>
created_by: User (FK)
category: <CharField>
score: <IntegerField>

HackAwardCategory (models.Model)

id: <IntegerField> (PK)
created: <DateTimeField>
updated: <DateTimeField>
created_by: User (FK)
display_name: <CharField>
description: <TextField>
winningProject: HackProject (FK)
  • Once you're happy with all changes, you can commit and push your code to the appropriate branch:
    • git add <files>
    • git commit -m "#ID: Your commit message details"
    • 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:
    • From your forked repo, the PR should look something like this:
      • base repository: Code-Institute-Community/ci-hackathon-app
      • base: master
      • head repository: your-own-account/forked repo
      • compare: your-own-branch
  • 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.
  • 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