add .env, wired database to settings, updated readme
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,6 +6,9 @@
|
|||||||
# VSCode
|
# VSCode
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
# environment variables
|
||||||
|
.env
|
||||||
|
|
||||||
# Node artifact files
|
# Node artifact files
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
|
|||||||
32
README.md
32
README.md
@@ -1,29 +1,21 @@
|
|||||||
# README #
|
# LaTiendaCOOP backend
|
||||||
|
|
||||||
This README would normally document whatever steps are necessary to get your application up and running.
|
This README aims to document functionality of backend as well as required steps to get it up and running.
|
||||||
|
|
||||||
### What is this repository for? ###
|
## Table of Contents
|
||||||
|
|
||||||
* Quick summary
|
- [First Steps](#first-steps)
|
||||||
* Version
|
|
||||||
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
|
|
||||||
|
|
||||||
### How do I get set up? ###
|
|
||||||
|
|
||||||
* Summary of set up
|
## First Steps
|
||||||
* Configuration
|
|
||||||
* Dependencies
|
|
||||||
* Database configuration
|
|
||||||
* How to run tests
|
|
||||||
* Deployment instructions
|
|
||||||
|
|
||||||
### Contribution guidelines ###
|
- Clone repository:
|
||||||
|
`git clone git@bitbucket.org:enreda/back-latienda.git`
|
||||||
|
- From inside the project's folder:
|
||||||
|
```
|
||||||
|
python manage.py makemigrations core companies products history stats
|
||||||
|
python migrate
|
||||||
|
|
||||||
* Writing tests
|
```
|
||||||
* Code review
|
|
||||||
* Other guidelines
|
|
||||||
|
|
||||||
### Who do I talk to? ###
|
|
||||||
|
|
||||||
* Repo owner or admin
|
|
||||||
* Other community or team contact
|
|
||||||
@@ -12,9 +12,16 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import dotenv
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
# Get variables from .env
|
||||||
|
dotenv.read_dotenv(
|
||||||
|
dotenv=os.path.join(BASE_DIR, '.env'),
|
||||||
|
override=True
|
||||||
|
)
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
||||||
@@ -37,6 +44,13 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
|
||||||
|
'core',
|
||||||
|
'companies',
|
||||||
|
'products',
|
||||||
|
'history',
|
||||||
|
'stats',
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
@@ -73,11 +87,16 @@ WSGI_APPLICATION = 'back_latienda.wsgi.application'
|
|||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
||||||
|
|
||||||
|
# Databases configuration
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.getenv('DB_NAME'),
|
||||||
}
|
'USER': os.getenv('DB_USER'),
|
||||||
|
'PASSWORD': os.getenv('DB_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DB_HOST', 'localhost'),
|
||||||
|
'PORT': os.getenv('DB_PORT', '5432'),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
6
example.env
Normal file
6
example.env
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# rename file to .env and populate fields accordingly
|
||||||
|
DB_HOST = 'localhost'
|
||||||
|
DB_PORT = '3306'
|
||||||
|
DB_NAME = ''
|
||||||
|
DB_USER = ''
|
||||||
|
DB_PASSWORD = ''
|
||||||
8
requirements.txt
Normal file
8
requirements.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Django==2.2.17
|
||||||
|
djangorestframework==3.12.2
|
||||||
|
djangorestframework-simplejwt==4.4.0
|
||||||
|
factory-boy==3.1.0
|
||||||
|
django-dotenv==1.4.2
|
||||||
|
django-filter==2.4.0
|
||||||
|
-e git://github.com/darklow/django-suit/@v2#egg=django-suit
|
||||||
|
django-cors-headers==3.5.0
|
||||||
Reference in New Issue
Block a user