

- #DOCKER FLASK POSTGRES APP HOW TO#
- #DOCKER FLASK POSTGRES APP INSTALL#
- #DOCKER FLASK POSTGRES APP CODE#
- #DOCKER FLASK POSTGRES APP PASSWORD#
- #DOCKER FLASK POSTGRES APP DOWNLOAD#
#DOCKER FLASK POSTGRES APP PASSWORD#
} As you could see in the above settings, the ' NAME ' attribute is the name of your database, while the ' USER ' and ' PASSWORD ' would need to be the same you would have used while setting up pgAdmin or PostgreSQL on your system. 'ENGINE': 'django.db.backends.postgresql_psycopg2', Open a terminal, navigate to this folder, type ' code.
#DOCKER FLASK POSTGRES APP DOWNLOAD#
Check the official Python download section if possible.Ĭreate an empty project folder called ' DockerDjangoReactProject'.
#DOCKER FLASK POSTGRES APP INSTALL#
Creating our backend Create a local Python environment and install the necessary packagesĮnsure you have Python 3.7 + installed in your system. We would also add Nginx to our docker workflow which would allow us to serve both our Django and React applications running within Docker containers. The reason we would use docker is not only because this is pretty much the standard for productionising applications, but also, as you would see, that it allows to seamlessly integrate all our developed work in a single docker workflow which is platform-independent and allows making deployments much easier with simple docker commands, in contrast to running individual applications with multiple commands.
#DOCKER FLASK POSTGRES APP HOW TO#
If you are interested only in knowing how to integrate Django and React together to create a simple but robust machine learning app, you may skip this section in the article.

Production build of our application – Docker

The user would be able to provide sample iris flower data, and then press a button to make predictions. Once the user hits enter on the button, the user-defined iris data would be sent to the backend through a POST API request. The backend would process this data and make predictions based on the trained machine learning model integrated into the backend.The user would be able to perform two things: Our Django application thus would serve the purpose of our backend and admin tasks.įrontend – React Once a user has been created, they would be able to login to a portal – the frontend, and interact with our machine learning model running on the backend through REST APIs. With the admin dashboard, we can register users to our application, who can then interact with our machine learning application to make predictions. Django comes packaged with a great admin dashboard. In the previous article, the Django application was connected with a SQLite database. For this article, however, we would use Postgres as our database, as Postgres is better suited for production builds. We would use the same Django application here and make some modifications as required. Please familiarize your self with that article. We have already covered this is in great detail in a previous article. the sepal and petal dimensions – length and width. We are going to create a simple machine learning application with Django REST framework, which predicts the species of a sample flower based on measurements of its features i.e.

What are we going to build? Backend – Django, Django REST framework, PostgresSQL To test the APIs we create, you would need to install Postman. Again feel free to use an editor of your choice.įor this project, as you would also see, later on, we would be creating REST APIs.
#DOCKER FLASK POSTGRES APP CODE#
I used VS Code as my editor as this is a free editor with many features and a built-in terminal which comes very handy for our use case. Docker was installed as the Docker Desktop version which comes pre-packaged with docker-compose, version 1.26.2 in my case. I would use these package managers for this article, but feel free to use any other package manager which works for you. Python and Node come with their default package managers i.e. You would need to have Python, Node, Postgres and Docker installed on your system. Although I would try to explain everything as much as I can, if you have some difficulty in understanding any concept please refer to the official documentation of Django, React, Docker, or any other documentation as necessary. Familiarity with Python, JavaScript, HTML, CSS and some basic Linux commands.
