<commit_before>.. _troubleshooting:

Troubleshooting
===============

Flaskage comes with several simple helpers for troubleshooting as you develop
your application.

The Shell
---------

A pre-configured shell using the incredible ipython may be invoked using the
following command:

.. code:: bash

    ./manage.py shell

Within this shell, several variables will automatically be made available:

* The Flask application object (app)
* The Flask-SQLAlchemy database object (db)
* All model classes (e.g. User, Post .etc)
* All factory classes (e.g. UserFactory, PostFactory .etc)

The shell is a great place to try out queries or troubleshoot your application.

The Python Debugger
-------------------

TODO

URL Mappings
------------

Unlike frameworks like Django and Rails, Flask allows you to configure your
routing right next to each view which is the preferred way of working in
Flaskage.

However, if you ever wish to see a full mapping of all URLs and their
associated view function, you may run:

..code:: bash

    ./manage.py urls

Switching Environments
----------------------

Any command that you invoke via manage.py will be run against the development
environment by default.  However, you may easily override this using the **-c**
option as shown below:

..code:: bash

    ./manage.py -c production shell

This example will run the shell using the production environment.<commit_msg>Repaired a few minor formatting errors in docs<commit_after>.. _troubleshooting:

Troubleshooting
===============

Flaskage comes with several simple helpers for troubleshooting as you develop
your application.

The Shell
---------

A pre-configured shell using the incredible ipython may be invoked using the
following command:

.. code:: bash

    ./manage.py shell

Within this shell, several variables will automatically be made available:

* The Flask application object (app)
* The Flask-SQLAlchemy database object (db)
* All model classes (e.g. User, Post .etc)
* All factory classes (e.g. UserFactory, PostFactory .etc)

The shell is a great place to try out queries or troubleshoot your application.

The Python Debugger
-------------------

TODO

URL Mappings
------------

Unlike frameworks like Django and Rails, Flask allows you to configure your
routing right next to each view which is the preferred way of working in
Flaskage.

However, if you ever wish to see a full mapping of all URLs and their
associated view function, you may run:

.. code:: bash

    ./manage.py urls

Switching Environments
----------------------

Any command that you invoke via manage.py will be run against the development
environment by default.  However, you may easily override this using the **-c**
option as shown below:

.. code:: bash

    ./manage.py -c production shell

This example will run the shell using the production environment.
{'fraction_non_alphanumeric': 0.10341188884980654, 'fraction_numerical': 0.0, 'mean_word_length': 3.283132530120482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5866546', 'n_tokens_mistral': 768, 'n_tokens_neox': 721, 'n_words': 384}