25
loading...
This website collects cookies to deliver better user experience
├── node_module
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── manifest.json
├── src
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── index.css
│ ├── index.js
│ ├── setupTests.js
├── .gitignore
├── package-lock.json
├── package.json
├── README.md
├── requirements.txt
axios
which is simple promise based HTTP client for the browser & node.js.npm install axios
proxy
at package.json
.npm
& node
version inside engines
at package.json
.index.js
.├── node_module
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── manifest.json
├── src
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── index.css
│ ├── index.js
│ ├── setupTests.js
├── ToDoProject
│ ├── __init__.py
│ ├── __pycache__
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── todoapp
│ ├── __init__.py
│ ├── __pycache__
│ ├── admin.py
│ ├── apps.py
│ ├── models.py
│ ├── serializers.py
│ ├── tests.py
│ ├── urls.py
│ |── utils.py
│ |── views.py
├── .gitignore
├── manage.py
├── package-lock.json
├── package.json
├── README.md
├── requirements.txt
INSTALLED_APPS
in Settings.py.requirements.txt
python-decouple: We can remove sensitive data like SEECERT_KEY, DB Password from settings.py
and add it in .env
file.
django-heroku: We have to Configure Django app for Heroku. This lib provides settings, logging and test runner configurations.
django: This will install the django.
djangorestframework: For creating the rest framework APIs we need to install it.
django-cors-headers: Django CORS(Cross Origin Resource Sharing) header allow resources to be accessed from other domains(i.e you can access your data from front-end domain).
gunicorn: Python WSGI HTTP Server.
whitenoise: This module helps to manage the static media for your application. This need to be added as a middleware in Django settings.py.
psycopg2: Psycopg is a PostgreSQL adapter for the Python programming language.
dj-database-url: This simple Django utility allows you to utilize the 12factor inspired DATABASE_URL environment variable to configure your Django application.
rest_framework
, corsheaders
and whitenoise.runserver_nostatic
in INSTALLED_APPS
in Settings.py.corsheaders
and whitenoise
as a middleware in Middleware
section. CORS_ORIGIN_ALLOW_ALL
as True
after Middleware
.Settings.py
..env
(This file is added at.gitignore
file) file like below then configure you Database
and add dj_database_url
after DATABASES
in Settings.py
.SECRET_KEY = xcr3tps4......
DEBUG = FALSE
DB_NAME = <DB_NAME>
USER_NAME = <USER_NAME>
PASSWORD = <PASSWORD>
HOST = localhost
build
template at django templates in Settings.py
.Settings.py
. STATICFILES_DIRS
pointing tobuild/static
path as React contains the static file to this path.heroku login
command.heroku create <APP_NAME>
heroku git:remote -a tasktrackerapps
ALLOWED_HOSTS
section at Settings.py
.ALLOWED_HOSTS = ['localhost','127.0.0.1','tasktrackerapps.herokuapp.com']
buid packs
. This is responsible to run dependencies of your application as well. $ heroku buildpacks:add --index 1 heroku/nodejs
$ heroku buildpacks:add --index 2 heroku/python
.env
file configuration from backend(steps 7). We should make sure that Heroku get those value from .env
. But these values are not present at my github repo. heroku config:set DEBUG=FALSE
heroku config:set SECRET_KEY=<SECRET_KEY>
heroku config:set DB_NAME=<DB_NAME>
heroku config:set USER_NAME=<USER_NAME>
heroku config:set PASSWORD=<PASSWORD>
heroku config:set HOST=localhost
heroku config
heroku addons:create heroku-postgresql:hobby-dev
heroku config | grep DATABASE_URL
OR
heroku pg:info
Click on Create One under Heroku Postgres.
Click on Install Heroku Postgres.
add-on
plan accordingly. I have chosen Hobby dev-free
plan for tasktrackerapps
app. It provides 1GB available free Postgres database.
PGUSER=<USER_NAME> PGPASSWORD=<PASSWORD> heroku pg:push postgres://<HOST>/<DB_NAME> <HERUKO_POSTGRES_DB_NAME>
Example:
PGUSER=postgres PGPASSWORD=postgres heroku pg:push postgres://localhost/taskapp postgresql-triangular-08058
collectstatic
.heroku config:set DISABLE_COLLECTSTATIC=1
web: gunicorn <Project_Name_Which_Contains_Settings.py>.wsgi --log-file -
python-3.9.9
├── node_module
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── manifest.json
├── src
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── index.css
│ ├── index.js
│ ├── setupTests.js
├── ToDoProject
│ ├── __init__.py
│ ├── __pycache__
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── todoapp
│ ├── __init__.py
│ ├── __pycache__
│ ├── admin.py
│ ├── apps.py
│ ├── models.py
│ ├── serializers.py
│ ├── tests.py
│ ├── urls.py
│ |── utils.py
│ |── views.py
├── .gitignore
├── manage.py
├── package-lock.json
├── package.json
├── Procfile
├── README.md
├── requirements.txt
├── runtime.txt
heroku logs --tail