Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wieczorek1990/websites
Recruitment task for user.com
https://github.com/wieczorek1990/websites
Last synced: 3 days ago
JSON representation
Recruitment task for user.com
- Host: GitHub
- URL: https://github.com/wieczorek1990/websites
- Owner: wieczorek1990
- Created: 2020-11-26T08:38:12.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-26T10:56:58.000Z (about 4 years ago)
- Last Synced: 2024-11-24T15:16:20.803Z (2 months ago)
- Language: Python
- Size: 89.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Repositories
## Envs
Create `/envs/` directory using `/envs.example/` as template.
```bash
# django
DJANGO_DEBUG # 0 or 1 for disabled/enabled
DJANGO_SECRET_KEY # 50 characters# postgres
POSTGRES_USERNAME # username
POSTGRES_PASSWORD # password# webshrinker
WEBSHRINKER_ACCESS_KEY # access_key
WEBSHRINKER_SECRET_KEY # secret_key
```You can obtain webshrinker keys from [here](https://dashboard.webshrinker.com/keys).
## Running
After creating envs run:
```bash
docker-compose up
```This starts with failure when database is yet not created.
## Database
Setting up database, e.g. for local instance:
```bash
docker-compose up
docker-compose exec postgres bash
psql -h postgres -U postgres # password is postgres
CREATE DATABASE websites WITH OWNER postgres ENCODING 'utf-8';
```Now run `docker-compose up` again for backend to start without failure.
## Tests
Running tests:
```bash
docker-compose up
docker-compose exec django bash
./manage.py test api.tests
```## Deployment
Deploy to production:
* create configuration (look into /docker-compose.yml and /Dockerfile)
* generate envs (look into /envs/)
* generate Djago secret with `pwgen -sy 50 1`# Heroku deployment
Environment variables:
* Install plugin `heroku plugins:install heroku-config`.
* Use `heroku config:pull` and `heroku config:push`.Add a database: `Heroku Postgres` in Resources.
Connect with GitHub and setup automatic `master` deployments.
Set stack to container: `heroku stack:set container`.
## Notes
* Took me 3h 0m to do the task
* I did not touch sorting the queryset and WebPage models