Skip to content

Commit

Permalink
Merge pull request #13 from GovReady/developer_docs
Browse files Browse the repository at this point in the history
Developer docs
  • Loading branch information
peterkaminski committed Oct 19, 2020
2 parents 763053b + 358c823 commit 25e4a89
Show file tree
Hide file tree
Showing 21 changed files with 64 additions and 9 deletions.
1 change: 0 additions & 1 deletion source/appendixes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ This section contains useful reference materials.
:maxdepth: 1

how-tos-and-faqs
data-model-design-guide/index
version-notes/index
File renamed without changes
Binary file added source/assets/Controls_Data_Model.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/Discussion_Data_Model.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/Guided_modules_Data_Model.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/Main_Data_Model.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/Siteapp_Data_Model.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ Static Assets

Static assets such as images can be referenced in module content
(introductions, question prompts, and output documents). These assets
are exposed by the Q web server(the server GovReady is deployed on) in its static path. Place static assets
are exposed by the Q web server (the server GovReady is deployed on) in its static path. Place static assets
in an ``assets`` subdirectory where the module is. When the asset is
referenced in a Markdown document template, its path will be rewritten
to be its public (virtual) path on the web server.
Expand Down
17 changes: 17 additions & 0 deletions source/developing-for-govready-q/code-style-guide/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. Copyright (C) 2020 GovReady PBC
.. _Code Style Guide:
.. _main:
.. _PEP 8 -- Style Guide for Python Code: https://www.python.org/dev/peps/pep-0008/


Code Style Guide
=======================

GovReady-Q’s code style guide.

- Python's official `PEP 8 -- Style Guide for Python Code`_




Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ model. The complete data model spans three categories:
The tables are described in additional detail below and their
relationships are summarized in the following diagram:

.. figure:: /assets/govready-q-guidedmodules-erd.png
.. figure:: /assets/Guided_modules_Data_Model.png
:alt: Guidedmodules data model (not all tables represented)

Guidedmodules data model (not all tables represented)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. Copyright (C) 2020 GovReady PBC
.. _Controls:

Controls
===========

The diagram below provides a summary representation of GovReady-Q’s
Django ``controls`` data model that handles controls, components, and combined statements.

.. figure:: /assets/Controls_Data_Model.png
:alt: Controls data model (not all tables represented)

Controls data model (not all tables represented)

A single control can be instantiated and associated to any number of components. A discussion can have multiple comments. Comments can
have multiple attachments. Users can be associated with any discussion as a guest via their discussion id.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ The diagram below provides a summary representation of GovReady-Q’s
Django ``discussion`` data model that handles discussions, comments, and
invitations.

.. figure:: /assets/govready-q-discussion-erd.png
.. figure:: /assets/Discussion_Data_Model.png
:alt: Discussion data model (not all tables represented)

Discussion data model (not all tables represented)

A single discussion can be instantiated and associated to any task (task
~= “question”). A discussion can have multiple comments. Comments can
have multiple attachments.
have multiple attachments. Users can be associated with any discussion as a guest via their discussion id.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.. Copyright (C) 2020 GovReady PBC
.. _Data Model Design Guide:
.. _main:


Data Model Design Guide
=======================
Expand All @@ -16,3 +18,13 @@ These pages describe GovReady-Q’s data model.
compliance-apps-modules-questions-tasks-and-answers
discussions
generating-detailed-data-models
controls

Overview of all data models:

.. image:: /assets/Main_Data_Model.png
:width: 400
:alt: uml diagram of all data models



Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The diagram below provides a summary representation of GovReady-Q’s
Django ``siteapp`` data model, which handles users, organizations,
projects and folders, and invitations.

.. figure:: /assets/govready-q-siteapp-erd.png
.. figure:: /assets/Siteapp_Data_Model.png
:alt: Siteapp data model (not all tables represented)

Siteapp data model (not all tables represented)
Expand Down
2 changes: 2 additions & 0 deletions source/developing-for-govready-q/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ You may also want to refer to the :ref:`Installation and Setup` section of the g
:maxdepth: 1

installing-govready-q-for-development
data-model-design-guide/index
code-style-guide/index


Examples for Setting Up Your Development Environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This should display a table in standard output close to:
Integrated Development Environment
______________________________________

Govready is IDE-agnostic but for the purposes of this tutorial we will assume you are using Pycharm(2020.xx). One exceedingly excellent feature of PyCharm is the ease at configuring and managing virtual environments and terminals used in each project. In order to seamlessly use WSL in PyCharm you can configure your terminal to run WSL by setting an absolute or relative path to the WSL executable file ``C:\Windows\System32\wsl.exe`` or ``wsl.exe``
Govready is IDE-agnostic but for the purposes of this tutorial we will assume you are using Pycharm (2020.xx). One exceedingly excellent feature of PyCharm is the ease of configuring and managing virtual environments and terminals used in each project. In order to seamlessly use WSL in PyCharm you can configure your terminal to run WSL by setting an absolute or relative path to the WSL executable file ``C:\Windows\System32\wsl.exe`` or ``wsl.exe``

In this Unix-like environment on your Windows computer we can essentially follow the :ref:`Server-based Installation`. However, to maintain a clean interpreter make sure to create and activate a virtual environment with virtualenv(as WSL **cannot** create virtual environments):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ Remember to Define Your ``host``
The **DisallowedHost…Invalid HTTP_HOST header…You may need to add ‘’ to
ALLOWED_HOSTS** is a common error received when first trying to get
GovReady-Q running on a server at a specific domain. The error indicates
the domain you are trying to visit is not white listed in Django’s
the domain you are trying to visit is not whitelisted in Django’s
special ``ALLOWED_HOST`` variable.

For security, Django requires white listing your server’s domain(s) in
For security, Django requires whitelisting your server’s domain(s) in
the ``ALLOWED_HOST`` variable. Ordinarily this is hardcoded into the
``settings.py`` file. GovReady-Q allows the ``ALLOWED_HOST`` to be set
by the ``host`` environment settings so the values can be passed at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@ Restart GovReady-Q server.

Once installed, add ``?profile`` to the end of a request URL to activate the profiler (or ``&profile`` if URL already includes GET params).

If you wish to profile every request, make sure to set your profiles directory in your ``settings.py``:

.. code:: python
PYINSTRUMENT_PROFILE_DIR = 'profiles'
The HTML documents generated will be in the designated profiles folder which will be instantiated if there is not already one in your working directory.

See `Pyinstrument Profile a web request in Django <https://github.com/joerick/pyinstrument#profile-a-web-request-in-django>`_ for more details.

0 comments on commit 25e4a89

Please sign in to comment.