A simple app to test using Python Flask in an Alpine-Python image, for local development and deployment through a CI pipeline
It has two routes '/' for a straight text response and '/test' for an html response
-
Clone the repository
-
Start PyCharm and "Open..." the flask-docker-skeleton directory
-
Go to Preferences > Project interpreter
-
Click the cog icon next to the Project interpreter and select 'Add...'
-
In the dialogue select 'Docker Compose' and accept the default values
-
Under Project interpreter, select Path mappings and map /front/app to /app
-
Click Ok and close the Project interpreter dialog
-
Make sure front/app is set as a Sources root
-
Add a new Run/Debug configuration
-
Select the Flask template
-
Set the Script path > Target to the 'front/app/app.py' file
-
Set Application to 'app'
-
Click 'Ok'
-
Make sure front/app is set as a Sources root
-
Add a new Run/Debug configuration
-
Select the tests > pytest template
-
Set the 'Script path' to the 'front/tests' directory
-
Click 'Ok'
You may need to enable Remote Interpreter. There is also a bug with PyCharm where the docker options can disappear from the list and the solution that worked for me was to delete my PyCharm settings folder and restart PyCharm
Current bug within pycharm where it might not detect that Docker is installed. Simple fix below.
- Run Tools | Create Command-line Launcher from the PyCharm menu.
- Run /usr/local/bin/charm from terminal.