-
Notifications
You must be signed in to change notification settings - Fork 41
Development
- Forking the repo
- Development in Gitpod
- Environment setup
- Local setup - you will still need to go through some of the steps in the environment setup
- Data Representation
- Committing your changes
- Creating a Pull Request (PR)
- First, you'll need to FORK this repository onto your own GitHub account.
- Read our guide on working with a forked repo
- You can find the button to Fork in the top-right corner of this page.
- > Read more information about Forking a Repository here <
- Once you have the repo forked, you can either clone your new repo locally, or work on it directly in Gitpod.
- NOTE: don't click the Gitpod button on this repository, you will have errors pushing any changes.
- > A demo of these steps can be found on this video from our Workshop call (15OCT2020) <
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.
Working in Gitpod will give you access to a Cloud IDE with most of the environment already out of the box and will avoid you having to set up most of the environment locally.
If you choose to develop locally, you can see how to proceed here
For working in Gitpod, here's the series of steps to take in order to proceed with development:
- 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
- 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)
-
- Ensure that you have both origin and upstream remotes on your forked project.
-
git remote -v
(view the remotes)
-
- Pull any updates from the master upstream branch, onto your current branch:
git pull upstream master
- 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
- 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
-
- Seed default data such as a standard adminuser and some additional development data:
scripts/seed.sh
- 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
In order to run this project locally on your own system, you will need the following installed (as a bare minimum):
- Python3 to run the application.
- PIP to install all app requirements.
- GIT for cloning and version control.
- Microsoft Visual Studio Code (or any suitable IDE).
To simplify the following setup steps, the community has created automated setup scripts for Linux/Mac and Windows. Here is how you can execute them:
- Open Terminal
- Give execute permissions to file
chmod +x setup.sh
- Run the setup file
./setup.sh
Requirements for Windows
- Python installed and added to path
Setup
- Open Powershell from the Windows menu (or right-click on the folder
- Navigate to the folder
- Run the file
setup.bat
- Setup a virtual environment using pipenv
- Copy and modify the
.env
(You still need to edit it and add your ownSECRET_KEY
)
- Create any branches for you
- Setup any databases or run any migration commands.
- Continue from step 3 in Environment setup
This will help with Issue: https://github.com/Code-Institute-Community/ci-hackathon-app/issues/70 and speed up development when using local IDE like VSCode.
If you experience any issues with the automated scripts, please raise a new issue here
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:
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
- From your forked repo, the PR should look something like this:
- 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)
- User Story ID:
- list the user story #ID for easier tracking (eg: #P01, #S02, #M03, #A04)
- Description of PR:
- description about what you're requesting in the PR
- try to be thorough, but concise
- Tests:
- list any testing you've done; manual or automated
- this could be code validation, unit tests, browser compatibility, responsiveness testing, etc.
- Know bugs/errors:
- list any known bugs/errors, or outstanding items that are still present
- Screenshots:
- you can paste screenshots directly into the PR if needed
Happy Coding, and thanks for Contributing to the Code Institute Community!