Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
add some environment variables in settings.py, update readme accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
corentinbettiol committed Oct 22, 2019
1 parent 1cf5219 commit 67cf254
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ the bugboard updates and sort [bugherd](https://www.bugherd.com/)'s tasks and co

### Prerequisites

You will need `python` 3 & `django`.
You will need `python3.7` & `django`.

Some sensitive data are read using `os.environ('KEY')`, you will need to `export` them in order to successfully launch the bugboard:
* `BUGHERD_API` : The access key used to get content from bugherd.com/api_v2/
* `SECRET_KEY` : The django secret key.
* `DB_USER` : PSQL username.
* `DB_PASS` : PSQL password.
* `DB_PASSWORD` : PSQL password.
* `DB_ENGINE` : `django.db.backends.postgresql_psycopg2` if you're using PSQL
* `DB_NAME` : PSQL database name (*bugboard seems to be a good name*)
* `DB_HOST` : Host UNIX entry point
* `ADMIN_URL` : Custom admin url (default is `admin/`)

### Install

Just put the application inside your django project, create one url from your project `urls.py` file, make the migrations, migrate the db, and you're done.
Just put the application inside your django project, create one url from your project `urls.py` file, store all the data in previous section inside your `.env` (if you're using `pipenv`), collect the static files, serve them, make the migrations, migrate the db, and you're done.

----

Expand Down
10 changes: 5 additions & 5 deletions randomdjangoprojectname/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["192.168.7.32", "127.0.0.1", "192.168.7.110", "192.168.7.131"]
ALLOWED_HOSTS = ["*"]


# Application definition
Expand Down Expand Up @@ -78,11 +78,11 @@

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "bugboard",
"ENGINE": os.environ["DB_ENGINE"],
"NAME": os.environ["DB_NAME"],
"USER": os.environ["DB_USER"],
"PASSWORD": os.environ["DB_PASS"],
"HOST": "localhost",
"PASSWORD": os.environ["DB_PASSWORD"],
"HOST": os.environ["DB_HOST"],
"PORT": "",
}
}
Expand Down
4 changes: 3 additions & 1 deletion randomdjangoprojectname/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
import os

# Third party
from django.contrib import admin
from django.urls import include, path


urlpatterns = [
path("", include("bugboard.urls")),
path("admin/", admin.site.urls),
path(os.environ["ADMIN_URL"] + "/", admin.site.urls),
path("bugboard/", include("bugboard.urls")),
]

0 comments on commit 67cf254

Please sign in to comment.