Giter Club home page Giter Club logo

beatitud-back's Introduction

Beatitud Server

Setup a development station

  1. install docker

  2. install docker-compose

  3. create a directory 'env' (it won't be pushed) to store critical information that MUST not appear in your repo.

    a/ create a file django_variables.env

    b/ set:

    DJANGO_SETTINGS_MODULE=beatitud_back.settings.local
    SECRET_KEY=#SET A KEY#
    

    c/ create a file db_postgres_variables.env

    d/ set:

    DB_USER=beatitud
    DB_DATABASE=beatitud
    DB_PASSWORD=#SET A PASSWORD#
    

    e/ create a file elasticsearch_variables.env

    f/ set:

    ELASTICSEARCH_ALIAS=elasticsearch-local
    
  4. docker-compose up --build -d

  5. docker-compose exec django /bin/bash

  6. python manage.py migrate

  7. python manage.py createsuperuser

Structure (TO READ)

beatitud_back
|-   apps
|-  |- app_name
|-  |-  |- contrib
|-  |-  |-  |- drf # Django rest framework
|-  |-  |-  |-  |- tests
|-  |-  |-  |-  |- serializers
|-  |-  |-  |-  |- urls
|-  |-  |-  |-  |- views
|-  |-  |- fixtures # for tests
|-  |-  |- tests
|-  |-  |- migrations 
|-  |-  |- __init__
|-  |-  |- ... (everything genereated by django-admin 
                startapp except from those move into contrib/drf)
|-   env                                     # Apps env var
|-   beatitud_back                           # All settings for this project

1- As Django said, every app should be independent from the project that's why we put them in a different directory. It is really important to think each app as a gear that could be used by another system in the future. 2- Since we are using Django rest framework we set this contribution in each app in a subdirectory with every files changed by this contribution so as to be able to choose another contribution one day and know exactly what we have to alter. 3- So every script or tools of an app should stay at the root of the app directory. But views must be moved in the drf directory. And urls could be moved or should redirect to another urls in drf.

Using python in container

Always remember to use

python manage.py shell

If not you will have to do at every launch after

import django
django.setup()

Otherwise settings in console won't be populated. See https://docs.djangoproject.com/en/2.1/topics/settings/. (You can setup pycharm to do it automatically in order to use its console.)

beatitud-back's People

Contributors

antoine-rose avatar

Watchers

 avatar  avatar  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.