122 lines
5.0 KiB
HTML
122 lines
5.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Quick Start - pyserve</title>
|
|
<link rel="stylesheet" href="../style.css">
|
|
</head>
|
|
<body>
|
|
<div id="container">
|
|
<div id="header">
|
|
<h1>pyserve</h1>
|
|
<div class="tagline">python application orchestrator</div>
|
|
</div>
|
|
|
|
<div class="breadcrumb">
|
|
<a href="../index.html">pyserve</a> » <a href="/getting-started/">Getting Started</a> » Quick Start
|
|
</div>
|
|
|
|
<div id="content">
|
|
<h2>Quick Start</h2>
|
|
|
|
<p>Get pyserve running in under 5 minutes.</p>
|
|
|
|
<h3>1. Create Configuration File</h3>
|
|
<p>Create a file named <code>config.yaml</code> in your project directory:</p>
|
|
|
|
<pre><span class="directive">http:</span>
|
|
<span class="directive">static_dir:</span> <span class="value">./static</span>
|
|
<span class="directive">templates_dir:</span> <span class="value">./templates</span>
|
|
|
|
<span class="directive">server:</span>
|
|
<span class="directive">host:</span> <span class="value">0.0.0.0</span>
|
|
<span class="directive">port:</span> <span class="value">8080</span>
|
|
|
|
<span class="directive">logging:</span>
|
|
<span class="directive">level:</span> <span class="value">INFO</span>
|
|
<span class="directive">console_output:</span> <span class="value">true</span>
|
|
|
|
<span class="directive">extensions:</span>
|
|
- <span class="directive">type:</span> <span class="value">routing</span>
|
|
<span class="directive">config:</span>
|
|
<span class="directive">regex_locations:</span>
|
|
<span class="value">"__default__"</span>:
|
|
<span class="directive">root:</span> <span class="value">"./static"</span>
|
|
<span class="directive">index_file:</span> <span class="value">"index.html"</span></pre>
|
|
|
|
<h3>2. Create Static Directory</h3>
|
|
<p>Create a <code>static</code> folder and add an <code>index.html</code>:</p>
|
|
|
|
<pre>mkdir -p static
|
|
echo '<h1>Hello from pyserve!</h1>' > static/index.html</pre>
|
|
|
|
<h3>3. Start the Server</h3>
|
|
<pre>pyserve</pre>
|
|
|
|
<p>You should see output like:</p>
|
|
<pre>Starting PyServe server on 0.0.0.0:8080</pre>
|
|
|
|
<h3>4. Open in Browser</h3>
|
|
<p>Navigate to <a href="http://localhost:8080">http://localhost:8080</a> — you should see your page!</p>
|
|
|
|
<h3>Using CLI Options</h3>
|
|
<p>Override configuration via command line:</p>
|
|
|
|
<pre><span class="comment"># Use a different config file</span>
|
|
pyserve -c /path/to/config.yaml
|
|
|
|
<span class="comment"># Override host and port</span>
|
|
pyserve --host 127.0.0.1 --port 9000
|
|
|
|
<span class="comment"># Enable debug mode (verbose logging)</span>
|
|
pyserve --debug</pre>
|
|
|
|
<h3>Example: Serve Documentation</h3>
|
|
<p>Serve a documentation directory with proper caching:</p>
|
|
|
|
<pre><span class="directive">http:</span>
|
|
<span class="directive">static_dir:</span> <span class="value">./docs</span>
|
|
|
|
<span class="directive">server:</span>
|
|
<span class="directive">host:</span> <span class="value">0.0.0.0</span>
|
|
<span class="directive">port:</span> <span class="value">8000</span>
|
|
|
|
<span class="directive">extensions:</span>
|
|
- <span class="directive">type:</span> <span class="value">routing</span>
|
|
<span class="directive">config:</span>
|
|
<span class="directive">regex_locations:</span>
|
|
<span class="value">"=/"</span>:
|
|
<span class="directive">root:</span> <span class="value">"./docs"</span>
|
|
<span class="directive">index_file:</span> <span class="value">"index.html"</span>
|
|
|
|
<span class="value">"~*\\.(css|js)$"</span>:
|
|
<span class="directive">root:</span> <span class="value">"./docs"</span>
|
|
<span class="directive">cache_control:</span> <span class="value">"public, max-age=3600"</span>
|
|
|
|
<span class="value">"~*\\.html$"</span>:
|
|
<span class="directive">root:</span> <span class="value">"./docs"</span>
|
|
<span class="directive">cache_control:</span> <span class="value">"no-cache"</span>
|
|
|
|
<span class="value">"__default__"</span>:
|
|
<span class="directive">root:</span> <span class="value">"./docs"</span>
|
|
<span class="directive">index_file:</span> <span class="value">"index.html"</span></pre>
|
|
|
|
<div class="note">
|
|
<strong>Next Steps:</strong>
|
|
<ul class="indent">
|
|
<li><a href="../guides/process-orchestration.html">Process Orchestration</a> — Run apps in isolated processes</li>
|
|
<li><a href="../guides/configuration.html">Configuration Guide</a> — Full configuration reference</li>
|
|
<li><a href="../guides/routing.html">Routing Guide</a> — nginx-style URL patterns</li>
|
|
<li><a href="../guides/reverse-proxy.html">Reverse Proxy</a> — Proxy to backend services</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="footer">
|
|
<p>pyserve © 2024-2025 | MIT License</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|