Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xaralis/nechcistadionnadluh.cz
Website for the referendum about football stadium in Pardubice
https://github.com/xaralis/nechcistadionnadluh.cz
Last synced: about 2 months ago
JSON representation
Website for the referendum about football stadium in Pardubice
- Host: GitHub
- URL: https://github.com/xaralis/nechcistadionnadluh.cz
- Owner: xaralis
- License: agpl-3.0
- Created: 2019-12-03T11:40:08.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-22T04:52:37.000Z (about 2 years ago)
- Last Synced: 2024-04-29T00:09:41.080Z (9 months ago)
- Language: HTML
- Size: 1.6 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NechciStadionNaDluh.cz
A referendum presentation website.
It is built using Python on top of [Django](https://www.djangoproject.com/)
web framework and [PostgreSQL](https://www.postgresql.org/) database.## Development
### Local installation
#### Prerequistes
This assumes you have **Python 3 installed**. To run in default
configuration, you also need **PostgreSQL server** up and running on `5432` port. You
also need a database and user ready. Defaults are:* **Username**: `nsnd`
* **Database**: `nsnd`
* **Password**: `nsnd`This can be changed by providing the `DATABASE_DSN` environment variable.
#### Installation
1. Clone the repository and cd into it
git clone [email protected]:xaralis/nechcistadionnadluh.cz.git
cd nechcistadionnadluh.cz2. Initialize virtual environment and activate it
make init-env
source .env/bin/activate3. Install dependencies
make install-dev
4. Run the application
make run
### Local installation using Docker
This app has docker-compose support prepared out-of-the-box. This will also
run PostgreSQL database in case you don't want to install it locally.docker-compose up
### Running tests
First, make sure you have test dependencies installed. Run:
make install-test
From now on, you can run the test suite using:
make test
## Configuration
All config is made using environment variables.
| Variable name | Description | Required | Default value |
|----------------|-----------------------------------------------------------------------|-------------------------|--------------------------------------------|
| `DEBUG` | Turns on debug mode if equal to '1'. Shall not be used in production. | No | None |
| `SECRET_KEY` | Key used for encryption. Provide a long random string value. | Yes if `DEBUG` is False | None |
| `DATABASE_DSN` | Database connection string | No | `postgresql://localhost:5432/nsnd` |## Production deployment
This application is designed to be deployed as Docker container. Therefore,
you can use your preferred orchestration tool like [Kubernetes](https://kubernetes.io/)
or [Docker swarm](https://github.com/docker/swarm).Or, you can simply launch it using Docker compose for small-scale installations
and/or testing purposes.Docker images are continuosly pushed to the Docker Hub
[xaralis/nechcistadionnadluh.cz](https://hub.docker.com/r/xaralis/nechcistadionnadluh.cz/). App is
exposed via NginX proxy at port `80`.1. Create your docker-compose.yml file somewhere:
```yaml
version: '3.4'services:
db:
image: postgres:9.6.10-alpine
volumes:
- dbdata:/var/lib/postgresql
restart: always
ports:
- "55433:5432"
environment:
POSTGRES_USER: nsnd
POSTGRES_PASS: nsnd
POSTGRES_DB: nsndwebsite:
build:
context: .
volumes:
- ./nsnd:/nsnd/nsnd
- media:/media
- thumbnails:/thumbnails
ports:
- "8080:80"
restart: always
environment:
DEBUG: 0
SECRET_KEY: "not-really-secret-key"
DATABASE_DSN: postgresql://nsnd:nsnd@db:5432/nsnd
ALLOWED_HOSTS: '*'
MEDIA_ROOT: /media
THUMBNAIL_CACHE_DIR: /thumbnailsvolumes:
dbdata:
media:
thumbnails:```
2. Run both the database and the application by a simple `up` command:
docker-compose up -d
3. Run migrations (in case there are some DB schema changes):
docker-compose exec --user nsnd website sh -c "django-admin migrate"
*Note*: You can easily update the app by the image tag in the compose file. Make
sure to re-run migrations when updating.## Running django commands in the container
You can easily run it using `docker exec`. Just make sure you're running it under `nsnd` user. Otherwise,
things will break.docker-compose exec --user nsnd website django-admin migrate