Skip to content

Commit

Permalink
Working on docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CheeseCake87 committed Nov 1, 2023
1 parent da80992 commit 42e0476
Show file tree
Hide file tree
Showing 10 changed files with 952 additions and 4 deletions.
263 changes: 263 additions & 0 deletions docs/blueprint-init.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Flask-Imp Blueprint __init__ | Flask-Imp</title>
<link rel="stylesheet" href="static/water.css">
<link rel="stylesheet" href="static/pygments.emacs-dull.css">
<link rel="apple-touch-icon" sizes="180x180" href="static/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="static/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="static/favicon-16x16.png">
<link rel="manifest" href="static/site.webmanifest">
<link rel="mask-icon" href="static/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
</head>
<body>

<aside>
<img width="50%" src="static/Flask-Imp-Medium.png" alt="Flask-Imp Logo" style="margin-top: 20px;">
<h1>Flask-Imp</h1>
<div><small>Last Updated:</small></div>
<div><small>Wed, 01 Nov 2023</small></div>

<h2>Menu</h2>
<ul>
<li><a href="index.html"><strong>Index</strong></a></li>
</ul>
<ul>


<li><strong>CLI Commands</strong></li>


<ul>


<li><a href="cli_commands-flask-imp_init.html">flask-imp init</a></li>



<li><a href="cli_commands-flask-imp_blueprint.html">flask-imp blueprint</a></li>


</ul>



<li><strong>Imp</strong></li>


<ul>


<li><a href="imp-introduction.html">Introduction</a></li>



<li><a href="imp-x-config-toml.html">x.config.toml</a></li>



<li><a href="imp-load-env-vars.html">Load Env Variables</a></li>


</ul>



<li><strong>Blueprint</strong></li>


<ul>


<li><a href="blueprint-introduction.html">Introduction</a></li>



<li><a href="blueprint-config-toml.html">config.toml</a></li>


</ul>



<li><strong>Imp.x</strong></li>


<ul>


<li><a href="imp_x-init_app-init.html">init_app, __init__</a></li>



<li><a href="imp_x-init_session.html">init_session</a></li>



<li><a href="imp_x-import_app_resources.html">import_app_resources</a></li>



<li><a href="imp_x-import_blueprint.html">import_blueprint</a></li>



<li><a href="imp_x-import_blueprints.html">import_blueprints</a></li>



<li><a href="imp_x-import_models.html">import_models</a></li>



<li><a href="imp_x-model.html">model</a></li>




</ul>



<li><strong>Blueprint.x</strong></li>


<ul>


<li><a href="blueprint-init.html">__init__</a></li>



<li><a href="blueprint_x-init_session.html">init_session</a></li>



<li><a href="blueprint_x-import_resources.html">import_resources</a></li>



<li><a href="blueprint_x-import_nested_blueprint.html">import_nested_blueprint</a></li>



<li><a href="blueprint_x-import_nested_blueprints.html">import_nested_blueprints</a></li>



<li><a href="blueprint_x-import_models.html">import_models</a></li>



<li><a href="blueprint_x-tmpl.html">tmpl</a></li>


</ul>



<li><strong>flask_imp.security</strong></li>


<ul>


<li><a href="flask_imp_security-login_check.html">login_check</a></li>



<li><a href="flask_imp_security-permission_check.html">permission_check</a></li>



<li><a href="flask_imp_security-pass_function_check.html">pass_function_check</a></li>



<li><a href="flask_imp_security-api_login_check.html">api_login_check</a></li>



<li><a href="flask_imp_security-include_csrf.html">include_csrf</a></li>


</ul>



<li><strong>flask_imp.auth</strong></li>


<ul>


<li><a href="flask_imp_auth-is_email_address_valid.html">is_email_address_valid</a></li>



<li><a href="flask_imp_auth-is_username_valid.html">is_username_valid</a></li>



<li><a href="flask_imp_auth-generate_csrf_token.html">generate_csrf_token</a></li>



<li><a href="flask_imp_auth-generate_private_key.html">generate_private_key</a></li>



<li><a href="flask_imp_auth-generate_email_validator.html">generate_email_validator</a></li>



<li><a href="flask_imp_auth-generate_numeric_validator.html">generate_numeric_validator</a></li>



<li><a href="flask_imp_auth-generate_alphanumeric_validator.html">generate_alphanumeric_validator</a></li>



<li><a href="flask_imp_auth-generate_password.html">generate_password</a></li>



<li><a href="flask_imp_auth-generate_salt.html">generate_salt</a></li>



<li><a href="flask_imp_auth-encrypt_password.html">encrypt_password</a></li>



<li><a href="flask_imp_auth-authenticate_password.html">authenticate_password</a></li>


</ul>


</ul>

<div style="padding-top: 5px; margin-bottom: 20px;"><small>These docs are generated by a
<a href="https://github.com/CheeseCake87/Flask-Imp/tree/master/docs_gen">Flask Static Site Generator</a>
built by <a href="https://github.com/CheeseCake87">David Carmichael</a> hosted on GitHub Pages.</small></div>
</aside>

<section>
<h1 style="font-size: 2.6rem; margin: 0;">Flask-Imp Blueprint __init__</h1>
<div class="highlight"><pre><span></span><span class="n">Blueprint</span><span class="p">(</span><span class="n">dunder_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">config_file</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">&quot;config.toml&quot;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span>
</pre></div>
<hr />
<p>Initializes the Flask-Imp Blueprint.</p>
<p><code>dunder_name</code> should always be set to <code>__name__</code></p>
<p><code>config_file</code> is the name of the config file to load.
It will be loaded from the same directory as the <code>__init__.py</code> file.</p>

</section>

</body>
</html>
55 changes: 54 additions & 1 deletion docs/blueprint_x-import_models.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,60 @@ <h2>Menu</h2>

<section>
<h1 style="font-size: 2.6rem; margin: 0;">Blueprint.import_models</h1>

<div class="highlight"><pre><span></span><span class="n">import_models</span><span class="p">(</span><span class="n">folder</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">&quot;models&quot;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span>
</pre></div>
<hr />
<p>Will import all the models from the given folder relative to the Blueprint's root directory.</p>
<p>Works the same as <a href="imp_x-import_models.html">Imp.x / import_models</a> but relative to the Blueprint root.</p>
<p>Blueprint models will also be available in the <a href="imp_x-model.html">Imp.x / model</a> lookup.</p>
<div class="highlight"><pre><span></span>my_blueprint/
├── routes/...
├── static/...
├── templates/...
├── animal_models.py
├── __init__.py
└── config.toml
</pre></div>
<p><strong>or</strong></p>
<div class="highlight"><pre><span></span>my_blueprint/
├── routes/...
├── static/...
├── templates/...
├── models/
│ └── animals.py
├── __init__.py
└── config.toml
</pre></div>
<p>File: <code>my_blueprint/__init__.py</code></p>
<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">flask_imp</span> <span class="kn">import</span> <span class="n">Blueprint</span>

<span class="n">bp</span> <span class="o">=</span> <span class="n">Blueprint</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>

<span class="n">bp</span><span class="o">.</span><span class="n">import_resources</span><span class="p">(</span><span class="s2">&quot;routes&quot;</span><span class="p">)</span>
<span class="n">bp</span><span class="o">.</span><span class="n">import_models</span><span class="p">(</span><span class="s2">&quot;animal_models.py&quot;</span><span class="p">)</span>
</pre></div>
<p><strong>or</strong></p>
<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">flask_imp</span> <span class="kn">import</span> <span class="n">Blueprint</span>

<span class="n">bp</span> <span class="o">=</span> <span class="n">Blueprint</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>

<span class="n">bp</span><span class="o">.</span><span class="n">import_resources</span><span class="p">(</span><span class="s2">&quot;routes&quot;</span><span class="p">)</span>
<span class="n">bp</span><span class="o">.</span><span class="n">import_models</span><span class="p">(</span><span class="s2">&quot;models&quot;</span><span class="p">)</span>
</pre></div>
<p>File: <code>my_blueprint/animal_models.py</code> or <code>my_blueprint/models/animals.py</code></p>
<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">app</span> <span class="kn">import</span> <span class="n">db</span>


<span class="k">class</span> <span class="nc">Animals</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
<span class="n">animal_id</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">Column</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">Integer</span><span class="p">,</span> <span class="n">primary_key</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">name</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">Column</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">String</span><span class="p">(</span><span class="mi">64</span><span class="p">),</span> <span class="n">index</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">unique</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">species</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">Column</span><span class="p">(</span><span class="n">db</span><span class="o">.</span><span class="n">String</span><span class="p">(</span><span class="mi">64</span><span class="p">),</span> <span class="n">index</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">unique</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>

</section>

</body>
Expand Down
50 changes: 49 additions & 1 deletion docs/blueprint_x-import_nested_blueprint.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,55 @@ <h2>Menu</h2>

<section>
<h1 style="font-size: 2.6rem; margin: 0;">Blueprint.import_nested_blueprint</h1>

<div class="highlight"><pre><span></span><span class="n">import_nested_blueprint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">blueprint</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span>
</pre></div>
<hr />
<p>Import a specified Flask-Imp or standard Flask Blueprint relative to the Blueprint root.</p>
<p>Works the same as <a href="imp_x-import_blueprint.html">Imp.x / import_blueprint</a> but relative to the Blueprint root.</p>
<p>Blueprints that are imported this way will be scoped to the parent Blueprint that imported them.</p>
<p><code>url_for('my_blueprint.my_nested_blueprint.index')</code></p>
<div class="highlight"><pre><span></span>my_blueprint/
├── routes/...
├── static/...
├── templates/...
├── my_nested_blueprint/
│ ├── routes/
│ │ └── index.py
│ ├── static/...
│ ├── templates/...
│ ├── __init__.py
│ └── config.toml
├── __init__.py
└── config.toml
</pre></div>
<p>File: <code>my_blueprint/__init__.py</code></p>
<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">flask_imp</span> <span class="kn">import</span> <span class="n">Blueprint</span>

<span class="n">bp</span> <span class="o">=</span> <span class="n">Blueprint</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>

<span class="n">bp</span><span class="o">.</span><span class="n">import_resources</span><span class="p">(</span><span class="s2">&quot;routes&quot;</span><span class="p">)</span>
<span class="n">bp</span><span class="o">.</span><span class="n">import_nested_blueprint</span><span class="p">(</span><span class="s2">&quot;my_nested_blueprint&quot;</span><span class="p">)</span>
</pre></div>
<p>File: <code>my_blueprint/my_nested_blueprint/__init__.py</code></p>
<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">flask_imp</span> <span class="kn">import</span> <span class="n">Blueprint</span>

<span class="n">bp</span> <span class="o">=</span> <span class="n">Blueprint</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>

<span class="n">bp</span><span class="o">.</span><span class="n">import_resources</span><span class="p">(</span><span class="s2">&quot;routes&quot;</span><span class="p">)</span>
</pre></div>
<p>File: <code>my_blueprint/my_nested_blueprint/routes/index.py</code></p>
<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">render_template</span>

<span class="kn">from</span> <span class="nn">..</span> <span class="kn">import</span> <span class="n">bp</span>


<span class="nd">@bp</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">index</span><span class="p">():</span>
<span class="k">return</span> <span class="n">render_template</span><span class="p">(</span><span class="n">bp</span><span class="o">.</span><span class="n">tmpl</span><span class="p">(</span><span class="s2">&quot;index.html&quot;</span><span class="p">))</span>
</pre></div>

</section>

</body>
Expand Down
Loading

0 comments on commit 42e0476

Please sign in to comment.