This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from SELab-2/development
Milestone 1 Merge
- Loading branch information
Showing
131 changed files
with
21,348 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: backend-tests | ||
run-name: backend-tests | ||
on: [push] | ||
jobs: | ||
Backend-linter-and-tests: | ||
runs-on: self-hosted | ||
environment: django tests | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [3.11] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install flake8 | ||
working-directory: ./backend | ||
- name: Create env file | ||
run: | | ||
echo "${{ secrets.ENV_FILE }}" > ./backend/.env | ||
working-directory: ./backend | ||
- name: Run Tests | ||
run: | | ||
python manage.py makemigrations | ||
python manage.py migrate | ||
python manage.py test | ||
working-directory: ./backend | ||
- name: Run Linter | ||
run: | | ||
flake8 --ignore=F405,F403,E501 . | ||
working-directory: ./backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
overs JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/ | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# AWS User-specific | ||
.idea/**/aws.xml | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# SonarLint plugin | ||
.idea/sonarlint/ | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
||
# environment map | ||
env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# Django # | ||
*.log | ||
*.pot | ||
*.pyc | ||
__pycache__ | ||
db.sqlite3 | ||
media | ||
|
||
# Backup files # | ||
*.bak | ||
|
||
# If you are using PyCharm # | ||
# User-specific stuff | ||
.idea/ | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Python # | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Distribution / packaging | ||
.Python build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
.pytest_cache/ | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery | ||
celerybeat-schedule.* | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
backend/.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# Sublime Text # | ||
*.tmlanguage.cache | ||
*.tmPreferences.cache | ||
*.stTheme.cache | ||
*.sublime-workspace | ||
*.sublime-project | ||
|
||
# sftp configuration file | ||
sftp-config.json | ||
|
||
# Package control specific files Package | ||
Control.last-run | ||
Control.ca-list | ||
Control.ca-bundle | ||
Control.system-ca-bundle | ||
GitHub.sublime-settings | ||
|
||
# Visual Studio Code # | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
.history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Dr-trottoir django backend | ||
|
||
## Setup | ||
|
||
The first thing to do is to clone the repository: | ||
|
||
```sh | ||
$ git clone [email protected]:SELab-2/Dr-Trottoir-5.git | ||
$ cd Dr-Trottoir-5 | ||
$ cd backend | ||
``` | ||
|
||
Create a virtual environment to install dependencies in and activate it: | ||
|
||
```sh | ||
$ virtualenv2 --no-site-packages env | ||
$ source env/bin/activate | ||
``` | ||
|
||
Then install the dependencies: | ||
|
||
```sh | ||
(env)$ pip install -r requirements.txt | ||
``` | ||
Note the `(env)` in front of the prompt. This indicates that this terminal | ||
session operates in a virtual environment set up by `virtualenv2`. | ||
|
||
Once `pip` has finished downloading the dependencies: | ||
|
||
### Database setup | ||
|
||
Download and install postgresql from [here](https://www.postgresql.org/download/). | ||
Make an empty database and a user for this project. | ||
|
||
In the backend directory. Copy the env file and fill in you own values. | ||
The location of .env should be in the same location of settings.py: | ||
```sh | ||
(env)$ cp .env.example .env | ||
``` | ||
|
||
### Run the backend | ||
```sh | ||
(env)$ python manage.py runserver | ||
``` | ||
And navigate to `http://127.0.0.1:8000`. | ||
|
||
|
||
## Tests | ||
|
||
Todo setup tests and testing environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DB_NAME=your_db_name | ||
DB_USER=your_db_user | ||
DB_PASSWORD=your_password | ||
DB_HOST=localhost | ||
DB_PORT=5432 | ||
EMAIL=[email protected] | ||
EMAIL_PASSWORD=my_app_password |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
ASGI config for backend project. | ||
It exposes the ASGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.asgi import get_asgi_application | ||
|
||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') | ||
|
||
application = get_asgi_application() |
Oops, something went wrong.