DaaS (Data as a Service) using Django and ElephantSQL demo
Activate virtual envirounment
pipenv shell
Install dependencies
pipenv install
Migrate Schema
python manage.py makemigrations && python manage.py migrate
Create Superuser for accessing Django Admin
python manage.py createsuperuser
Sample configuration
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'database_name',
'USER': 'database_username',
'PASSWORD': 'database_password',
'HOST': 'databast_host',
'PORT': 'database_port',
}
}
python manage.py runserver
Navigate to localhost:8000
If you wanna deploy this simple app to Heroku, follow this step
Create Heroku instance
heroku create
Deploy to heroku
git push heroku master
Open app on heroku
heroku open
Or, if you wanna run locally
If you’re on Microsoft Windows system, run this:
heroku local web -f Procfile.windows
If you’re on a Unix system, just use the default Procfile
by running:
heroku local web
Open http://localhost:8000 with your web browser. You should see your app running locally.
Login to admin page, navigate to http://localhost:8000/admin insert username and password as follow :
Username : ayam Password : ayambakar