"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "docs/cli.rst" between
flask-1.1.1.tar.gz and flask-1.1.2.tar.gz

About: Flask is a lightweight Python WSGI web application framework.

cli.rst  (flask-1.1.1):cli.rst  (flask-1.1.2)
skipping to change at line 477 skipping to change at line 477
load the entry point. load the entry point.
The ``flask`` command, being separate from your code, does not have The ``flask`` command, being separate from your code, does not have
this issue and is recommended in most cases. this issue and is recommended in most cases.
.. _console script: https://packaging.python.org/tutorials/packaging-projects/#c onsole-scripts .. _console script: https://packaging.python.org/tutorials/packaging-projects/#c onsole-scripts
PyCharm Integration PyCharm Integration
------------------- -------------------
Prior to PyCharm 2018.1, the Flask CLI features weren't yet fully PyCharm Professional provides a special Flask run configuration. For
integrated into PyCharm. We have to do a few tweaks to get them working the Community Edition, we need to configure it to call the ``flask run``
smoothly. These instructions should be similar for any other IDE you CLI command with the correct environment variables. These instructions
might want to use. should be similar for any other IDE you might want to use.
In PyCharm, with your project open, click on *Run* from the menu bar and In PyCharm, with your project open, click on *Run* from the menu bar and
go to *Edit Configurations*. You'll be greeted by a screen similar to go to *Edit Configurations*. You'll be greeted by a screen similar to
this: this:
.. image:: _static/pycharm-runconfig.png .. image:: _static/pycharm-runconfig.png
:align: center :align: center
:class: screenshot :class: screenshot
:alt: screenshot of pycharm's run configuration settings :alt: Screenshot of PyCharms's run configuration settings.
There's quite a few options to change, but once we've done it for one There's quite a few options to change, but once we've done it for one
command, we can easily copy the entire configuration and make a single command, we can easily copy the entire configuration and make a single
tweak to give us access to other commands, including any custom ones you tweak to give us access to other commands, including any custom ones you
may implement yourself. may implement yourself.
Click the + (*Add New Configuration*) button and select *Python*. Give Click the + (*Add New Configuration*) button and select *Python*. Give
the configuration a good descriptive name such as "Run Flask Server". the configuration a name such as "flask run". For the ``flask run``
For the ``flask run`` command, check "Single instance only" since you command, check "Single instance only" since you can't run the server
can't run the server more than once at the same time. more than once at the same time.
Select *Module name* from the dropdown (**A**) then input ``flask``. Select *Module name* from the dropdown (**A**) then input ``flask``.
The *Parameters* field (**B**) is set to the CLI command to execute The *Parameters* field (**B**) is set to the CLI command to execute
(with any arguments). In this example we use ``run``, which will run (with any arguments). In this example we use ``run``, which will run
the development server. the development server.
You can skip this next step if you're using :ref:`dotenv`. We need to You can skip this next step if you're using :ref:`dotenv`. We need to
add an environment variable (**C**) to identify our application. Click add an environment variable (**C**) to identify our application. Click
on the browse button and add an entry with ``FLASK_APP`` on the left and on the browse button and add an entry with ``FLASK_APP`` on the left and
the Python import or file on the right (``hello`` for example). the Python import or file on the right (``hello`` for example). Add an
entry with ``FLASK_ENV`` and set it to ``development``.
Next we need to set the working directory (**D**) to be the folder where Next we need to set the working directory (**D**) to be the folder where
our application resides. our application resides.
If you have installed your project as a package in your virtualenv, you If you have installed your project as a package in your virtualenv, you
may untick the *PYTHONPATH* options (**E**). This will more accurately may untick the *PYTHONPATH* options (**E**). This will more accurately
match how you deploy the app later. match how you deploy the app later.
Click *Apply* to save the configuration, or *OK* to save and close the Click *Apply* to save the configuration, or *OK* to save and close the
window. Select the configuration in the main PyCharm window and click window. Select the configuration in the main PyCharm window and click
 End of changes. 4 change blocks. 
9 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)