Update readme.
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
DEPLOY_ENV=local
|
DEPLOY_ENV=local
|
||||||
SENTRY_DSN=
|
SENTRY_DSN=
|
||||||
HOST=api.dev.sahkoinsinoorikilta.fi
|
HOST=localhost
|
||||||
DEBUG=True
|
DEBUG=True
|
||||||
SECRET_KEY=7p$85^4ibb^p4-=vs44b7!y0e-zemugze18@a#30&71=a8)dp(
|
SECRET_KEY=7p$85^4ibb^p4-=vs44b7!y0e-zemugze18@a#30&71=a8)dp(
|
||||||
DB_NAME=postgres
|
DB_NAME=postgres
|
||||||
DB_USER=postgres
|
DB_USER=postgres
|
||||||
DB_PASSWD=postgres
|
DB_PASSWD=postgres
|
||||||
DB_HOST=db
|
DB_HOST=localhost
|
||||||
DB_PORT=5432
|
DB_PORT=5432
|
||||||
EMAIL_API_KEY=
|
EMAIL_API_KEY=
|
||||||
|
GROUP_KEY=
|
||||||
|
GOOGLE_CREDS='{}'
|
||||||
|
|||||||
@@ -1,24 +1,13 @@
|
|||||||
# SIKWEB 2.0
|
# Web 2.0 Backend
|
||||||
|
|
||||||
A modern web app using a Django backend and an Angular frontend.
|
[Django](https://www.djangoproject.com/) backend containing multiple small applications and api for Next.js frontend.
|
||||||
|
|
||||||
## Components
|
* **Web app:** Backend for the main website.
|
||||||
|
* **Member register:** Data table app for viewing and modifying the member register, member applications and membership payments.
|
||||||
### Infoscreen
|
* **Kaehmy:** Form for creating and listing kaehmys
|
||||||
|
* **Ohlhafv:** Form for creating and listing ohlhafv challenges.
|
||||||
Angular-based slideshow app for the guild room's screens.
|
* **Infoscreen:** Angular-based slideshow app for the guild room's screens.
|
||||||
|
## Installation
|
||||||
### Member register
|
|
||||||
|
|
||||||
Data table app for viewing and modifying the member register, member applications and membership payments.
|
|
||||||
|
|
||||||
### Web app
|
|
||||||
|
|
||||||
Mostly static website with an event calendar and news feed.
|
|
||||||
|
|
||||||
## Accessing the source
|
|
||||||
|
|
||||||
### Clone this repository and enter it
|
|
||||||
|
|
||||||
Set up your SSH key authentication in GitLab Profile Settings. Then clone the repository and checkout the development branch:
|
Set up your SSH key authentication in GitLab Profile Settings. Then clone the repository and checkout the development branch:
|
||||||
|
|
||||||
@@ -28,12 +17,17 @@ cd web2.0-backend
|
|||||||
git checkout develop
|
git checkout develop
|
||||||
```
|
```
|
||||||
|
|
||||||
## Development
|
Copy env file for local use:
|
||||||
|
```bash
|
||||||
|
cp .env.dev .env
|
||||||
|
```
|
||||||
|
|
||||||
### Poetry
|
### Poetry
|
||||||
|
|
||||||
For depedencies and virtual environment, we use [poetry](https://python-poetry.org/).
|
For depedencies and virtual environment, we use [poetry](https://python-poetry.org/).
|
||||||
|
|
||||||
|
First install [python](https://wiki.python.org/moin/BeginnersGuide/Download). Then install poetry:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -m pip install poetry
|
python3 -m pip install poetry
|
||||||
```
|
```
|
||||||
@@ -44,9 +38,26 @@ The easiest integration with VSCode is to have poetry install virtual environmen
|
|||||||
python3 -m poetry config virtualenvs.in-project true
|
python3 -m poetry config virtualenvs.in-project true
|
||||||
```
|
```
|
||||||
|
|
||||||
Start developing by install dependencies first
|
### Node
|
||||||
|
|
||||||
#### CMDs
|
We use Node.js for few development tasks, like linting. Easiest way to install Node is [nvm](https://github.com/nvm-sh/nvm). After installing install dependencies:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
TODO: List scripts
|
||||||
|
|
||||||
|
### Database
|
||||||
|
|
||||||
|
To run a local development database **[docker](https://docs.docker.com/engine/install/)** is recommended. If you want to additianally use a db management tool **[pgAdmin](https://www.pgadmin.org/download/)** is nice.
|
||||||
|
|
||||||
|
After installing docker use the following to create a database:
|
||||||
|
```bash
|
||||||
|
docker run --name postgres:12 -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres:12
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
Activate virtual environment in shell
|
Activate virtual environment in shell
|
||||||
|
|
||||||
@@ -60,20 +71,15 @@ Install dependencies
|
|||||||
poetry install
|
poetry install
|
||||||
```
|
```
|
||||||
|
|
||||||
### npm scripts
|
|
||||||
|
|
||||||
We use Node.js for few development tasks, like linting. Easiest way to install Node is [nvm](https://github.com/nvm-sh/nvm).
|
|
||||||
|
|
||||||
TODO: List scripts
|
|
||||||
|
|
||||||
### Initializing data
|
### Initializing data
|
||||||
|
|
||||||
Run the following `manage.py` commands. Do not run these in production without thinking!
|
Run the following `manage.py` commands to initialize a new database. Do not run these in production without thinking!
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python manage.py createdefaultadmin # creates an admin user
|
python manage.py migrate # run migrations
|
||||||
python manage.py initialize # creates user groups
|
python manage.py createdefaultadmin # creates an admin user
|
||||||
python manage.py createdummydata # creates dummy members to the member register
|
python manage.py initialize # creates user groups
|
||||||
|
python manage.py createdummydata # creates dummy members to the member register
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running
|
### Running
|
||||||
@@ -82,8 +88,6 @@ python manage.py createdummydata # creates dummy members to the member regis
|
|||||||
python manage.py runserver
|
python manage.py runserver
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Visit the page
|
|
||||||
|
|
||||||
Visit [https://localhost:8000](https://localhost:8000) in your browser!
|
Visit [https://localhost:8000](https://localhost:8000) in your browser!
|
||||||
|
|
||||||
Using address `0.0.0.0` will bind to all IP addresses. Using `localhost` will only bind to your machine.
|
Using address `0.0.0.0` will bind to all IP addresses. Using `localhost` will only bind to your machine.
|
||||||
@@ -99,7 +103,7 @@ When you start working on a feature, create a feature branch for your changes. T
|
|||||||
Example of creating a feature branch:
|
Example of creating a feature branch:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git checkout -b feature-error-page
|
git checkout -b feature-branch-name
|
||||||
```
|
```
|
||||||
|
|
||||||
When your changes are ready and the code works without errors, submit a merge request to `develop` in GitLab. Another developer reviews your changes and runs the merge. Feature branches should be closed on merge.
|
When your changes are ready and the code works without errors, submit a merge request to `develop` in GitLab. Another developer reviews your changes and runs the merge. Feature branches should be closed on merge.
|
||||||
@@ -110,16 +114,18 @@ Merge requests to `master` should be reviewed by multiple developers. Only a mod
|
|||||||
|
|
||||||
### Linting
|
### Linting
|
||||||
|
|
||||||
Lint python files using `pycodestyle` with
|
Lint python files using `black` with
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pycodestyle --config=pycodestyle.cfg --count .
|
npm run lint:py # check changes
|
||||||
|
npm run lint:py:fix # fix errors
|
||||||
```
|
```
|
||||||
|
|
||||||
Lint javascript and markdown using `eslint` and `remark` with
|
Lint javascript and markdown using `eslint` and `remark` with
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm test
|
npm run lint:md # markdown
|
||||||
|
npm run lint:js # javascript
|
||||||
```
|
```
|
||||||
|
|
||||||
Use an editor with linting capabilities to write pretty code that passes linting. Examples include _VSCode_, _Atom_ and _Pycharm_.
|
Use an editor with linting capabilities to write pretty code that passes linting. Examples include _VSCode_, _Atom_ and _Pycharm_.
|
||||||
@@ -140,6 +146,8 @@ Tests are located in `tests.py` under every subproject.
|
|||||||
|
|
||||||
Project is run in production with Docker. See `Dockerfile` for details.
|
Project is run in production with Docker. See `Dockerfile` for details.
|
||||||
|
|
||||||
|
For more information about deployment check **[infra](https://gitlab.com/sahkoinsinoorikilta/vtmk/infra)** repository.
|
||||||
|
|
||||||
## GitLab CI
|
## GitLab CI
|
||||||
|
|
||||||
All pushed changes go through the GitLab Continuous Integration, which consists of automated unit testing and linting. Make sure your changes pass both before merging to `develop` or `master`.
|
All pushed changes go through the GitLab Continuous Integration, which consists of automated unit testing and linting. Make sure your changes pass both before merging to `develop` or `master`.
|
||||||
|
|||||||
Reference in New Issue
Block a user