Skip to content

Latest commit

 

History

History
89 lines (59 loc) · 2.55 KB

pycharm.rst

File metadata and controls

89 lines (59 loc) · 2.55 KB

PyCharm Dev Setup

Here you learn how you could debug or extend Flask-Squirrel using the very good IDE JetBrains PyCharm.

Base Setup

First make sure you have cloned the git repo to your developer's project directory.

  • Choose "New Project" in the startup dialog.
  • Select the flask-squirrel checkout path
  • Specify the "venv" directory for the virtual environment
  • Do NOT create a main.py script
images/pycharm1_newproject.png
  • Say "yes" to create a project from existing source (dialog)
  • go to the "Settings" menu
images/pycharm2_menusettings.png
  • go to "Project: flask-squirrel" > Python interpreter
  • click the gear button on the right side, select "Add..."
images/pycharm3_interpretersettings.png
  • accept default "Virtual Environment" and "venv" path in project directory
images/pycharm4_newinterpreter.png
  • press "ok" to accept the new settings
  • a new venv will be created
  • open any Python file in the editor
  • a popup message box appears saying that the requirements are not installed yet
images/pycharm5_installdeps.png
  • click on "Install Requirements" and select all dependencies

pytest Target

To run the pytests do the following steps:

  • Create a new run configuration with the button on the top-right
  • On the "add" button select "pytest"
images/pycharm6_addrunconfig.png
  • Name it "pytest all"
  • Select "Custom" target
  • Additional arguments: -v
  • Set the working directory to the project base path ("tests" directory will automatically searched py pytest)
images/pycharm7_pytesttarget.png
  • Run the tests with the "play" button
images/pycharm8_pytest_run.png

Orderings Demo

To run the "Orderings" example in PyCharm do the following steps. The description is not as detailed as above.

  • Go into "Edit Configurations..."
  • On the "add" button select "Python"
  • Name it "Example Orderings"
  • Enter the script by hand: backend.py
  • Working directory: /home/dev/flask-squirrel/examples/orderings
images/pycharm9_orderingstarget.png images/pycharm10_orderingsbrowser.png