Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tawounfouet/django-everycheese
The ultimate cheese index
https://github.com/tawounfouet/django-everycheese
Last synced: 2 days ago
JSON representation
The ultimate cheese index
- Host: GitHub
- URL: https://github.com/tawounfouet/django-everycheese
- Owner: tawounfouet
- License: gpl-3.0
- Created: 2023-10-06T21:06:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-07T00:37:25.000Z (over 1 year ago)
- Last Synced: 2025-01-06T19:59:11.442Z (2 days ago)
- Language: Python
- Size: 77.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
EveryCheese
==============================The Ultimate Cheese Index!
### Quick setup
> The next steps assume that conda is already installed
1 - Create a conda environment:
```bash
conda create python=3.8 -n everycheese
```
2 - Activate the conda environment```bash
conda activate everycheese
```3 - Install the project basic dependencies and development dependencies
> Make sure you are inside the root project directory before executing the next commands.
>
> The root project directory is the directory that contains the `manage.py` fileOn Linux and Mac
```bash
pip install -r requirements/local.txt
```On Windows
```bash
pip install -r requirements\local.txt
```4 - Configure the database connection string on the .env
On Linux and Mac
```bash
cp env.sample.mac_or_linux .env
```On Windows
```bash
copy env.sample.windows .env
```Change the value of the variable `DATABASE_URL` inside the file` .env` with the information of the database we want to connect.
Note: Several project settings have been configured so that they can be easily manipulated using environment variables or a plain text configuration file, such as the `.env` file.
This is done with the help of a library called django-environ. We can see the formats expected by `DATABASE_URL` at https://github.com/jacobian/dj-database-url#url-schema.5 - Use the django-extension's `sqlcreate` management command to help to create the database
On Linux:
```bash
python manage.py sqlcreate | sudo -u postgres psql -U postgres
```On Mac:
```bash
python manage.py sqlcreate | psql
```On Windows:
Since [there is no official support for PostgreSQL 12 on Windows 10](https://www.postgresql.org/download/windows/) (officially PostgreSQL 12 is only supported on Windows Server), we choose to use SQLite3 on Windows
6 - Run the `migrations` to finish configuring the database to able to run the project
```bash
python manage.py migrate
```### Running the tests and coverage test
```bash
coverage run -m pytest
```If for some reason you get an error similar to bellow, is because the DATABASE_URL is configured to `postgres:///everycheese` and because of it the generated `DATABASES` settings are configured to connect on PostgreSQL using the socket mode.
In that case, you must create the database manually because the `sqlcreate` is not capable to correctly generate the SQL query in this case.```sql
ERROR: syntax error at or near "WITH"
LINE 1: CREATE USER WITH ENCRYPTED PASSWORD '' CREATEDB;
^
ERROR: zero-length delimited identifier at or near """"
LINE 1: CREATE DATABASE everycheese WITH ENCODING 'UTF-8' OWNER "";
^
ERROR: syntax error at or near ";"
LINE 1: GRANT ALL PRIVILEGES ON DATABASE everycheese TO ;
``````sql
ERROR: role "myuser" already exists
ERROR: database "everycheese" already exists
GRANT
```> :warning: **Be very careful here!**: The commands below erase data, and should only be executed on your local development machine and **NEVER** on a production server.
On Linux:
```bash
sudo -u postgres dropdb -U postgres --if-exists everycheese
sudo -u postgres dropuser -U postgres --if-exists myuser
```On Mac:
```bash
dropdb --if-exists everycheese
dropuser --if-exists myuser
```