Skip to content

sitn/geoshop-back

 
 

Repository files navigation

Geoshop Backend

Requirements

  • PostgreSQL >= 11 + PostGIS
  • Python >= 3.9
  • GDAL

Getting started

Fork and clone this repository. Make a copy of default_settings.py and .env.sample file and adapt it to your environment settings:

cp default_settings.py settings.py
cp .env.sample .env

.env will vary depending on the environements you're targetting. settings.py will get the specific config of your project.

Database

Create a geoshop user if not existing yet, set your password according to your env.local:

CREATE ROLE geoshop WITH LOGIN PASSWORD <password>;

Then, set up a database:

CREATE DATABASE geoshop OWNER geoshop;
REVOKE ALL ON DATABASE geoshop FROM PUBLIC;

Then connect to the geoshop database and create extensions:

CREATE EXTENSION postgis;
CREATE EXTENSION unaccent;
CREATE EXTENSION "uuid-ossp";
CREATE SCHEMA geoshop AUTHORIZATION geoshop;

-- TODO: Only if french is needed
CREATE TEXT SEARCH CONFIGURATION fr (COPY = simple);
ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING FOR hword, hword_part, word
WITH unaccent, simple;

Now that the database is ready, you can start backend either with Docker or not.

Run dev server without docker on Windows

You'll need to configure 3 paths to your GDAL installation according to .env.sample.

Then, we're going to:

  • Run migrations
  • Collect static files for the admin interface
  • Generate translations for your langage
  • Add minimal users to database
python manage.py migrate
python manage.py collectstatic
python manage.py compilemessages --locale=fr
python manage.py fixturize

Finally, you can run the server:

python manage.py runserver

Run tests

python manage.py test

Customize

custom.js in api/templates/gis/admin

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.4%
  • HTML 1.5%
  • Other 0.1%