Git Product home page Git Product logo

scheinkultur's Introduction

scheinkultur

Behalte deine Scheine im Blick.

Quick setup

The next steps assume that conda is already installed

1 - Create a conda environment:

conda create python=3.8 -n scheinkultur

2 - Activate the conda environment

conda activate scheinkultur

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 file

On Linux and Mac

pip install -r requirements/local.txt

On Windows

pip install -r requirements\local.txt

4 - Configure the database connection string on the .env

On Linux and Mac

cp env.sample.mac_or_linux .env

On Windows

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:

python manage.py sqlcreate | sudo -u postgres psql -U postgres

On Mac:

python manage.py sqlcreate | psql

On Windows:

Since there is no official support for PostgreSQL 12 on Windows 10 (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

python manage.py migrate
coverage run -m pytest

If for some reason you get an error similar to bellow, is because the DATABASE_URL is configured to postgres:///scheinkultur 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.

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 scheinkultur WITH ENCODING 'UTF-8' OWNER "";
                                                             ^
ERROR:  syntax error at or near ";"
LINE 1: GRANT ALL PRIVILEGES ON DATABASE scheinkultur TO ;
ERROR:  role "myuser" already exists
ERROR:  database "scheinkultur" already exists
GRANT

You can delete the database and the user with the commands below and then perform step 5 again.

โš ๏ธ 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:

sudo -u postgres dropdb -U postgres --if-exists scheinkultur
sudo -u postgres dropuser -U postgres --if-exists myuser

On Mac:

dropdb --if-exists scheinkultur
dropuser --if-exists myuser

scheinkultur's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.