GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.fullstackpython.com — Static Site Generators Static Site GeneratorsA static website generator combines a markup language, such as Markdown or reStructuredText, with a templating engine such as Jinja, to produce HTML files. The HTML files can be hosted and served by a web server or content delivery network (CDN) without any additional dependencies such as a WSGI server. Why are static site generators useful?Static content files such as HTML, CSS and JavaScript can be served from a content delivery network (CDN) for high scale and low cost. If a statically generated website is hit by high concurrent traffic it will be easily served by the CDN without dropped connections. For example, when Full Stack Python was on the top of Hacker News for a weekend, GitHub Pages was used as a CDN to serve the site and didn't have any issues even with close to 400 concurrent connections at a time, as shown in the following Google Analytics screenshot captured during that traffic burst.
How do static website generators work?Static site generators allow a user to create HTML files by writing in a markup language and coding template files. The static site generator then combines the markup language and templates to produce HTML. The output HTML does not need to be maintained by hand because it is regenerated every time the markup or templates are modified. For example, as shown in the diagram below, the Pelican static site generator can take in reStructuredText files and Jinja2 template files as input then combine them to output a set of static HTML files.
What's the downside of using static site generators?The major downside is that code cannot be executed after a site is created. You are stuck with the output files so if you're used to building web applications with a traditional web framework you'll have to change your expectations. Content that is typically powered by a database, such as comments, sessions and user data can only be handled through third party services. For example, if you want to have comments on a static website you'd need to embed Disqus's form and be completely reliant upon their service. Many web applications simply cannot be built with only a static site generator. However, a static website generator can create part of a site that will be served up by a web server while other pages are handled by the WSGI server. If done right, those web applications have the potential to scale better than if every page is rendered by the WSGI server. The complexity may or may not be worth it for your specific application. Python implementationsNumerous static website generators exist in many different languages. The ones listed here are primarily coded in Python.
Open source Python static site generator examples
Static site generator resourcesStatic site generators can be implemented in any programming language. The following resources either are general to any programming ecosystem or provide a unique angle on how to use a static site generator.
Static site deployment resourcesDeploying a static site is far less complicated than a traditional web application deployment, but you still need to host the files somewhere accessible. You'll also to set up DNS to point a domain name to your site as well as provide HTTPS support. These guides walk through various ways of handling the static site deployment.
What else do you want to learn about Python web dev?
1. Introduction
2. Development Environments
3. Data
4. Web Development
Web Frameworks
Django
Flask
Bottle
Pyramid
TurboGears
Falcon
Morepath
Sanic
Other Web Frameworks
Template Engines
Jinja2
Mako
Django Templates
Web Design
HTML
Cascading Style Sheets (CSS)
Responsive Design
Minification
CSS Frameworks
Bootstrap
Foundation
JavaScript
React
Vue.js
Angular
Task Queues
Celery
Redis Queue (RQ)
Dramatiq
Static Site Generators
Pelican
Lektor
MkDocs
Testing
Unit Testing
Integration Testing
Debugging
Code Metrics
Networking
HTTPS
WebSockets
WebRTC
Web APIs
Microservices
Webhooks
Bots
API Creation
API Frameworks
Django REST Framework
API Integration
Twilio
Stripe
Slack
Okta
Security
SQL Injection
CSRF
5. Deployment
6. DevOps
Changelog
What Full Stack Means
About the Author
Future Directions
Page Statuses
...or view the full table of contents.
Full Stack Python
Full Stack Python
is an open book that explains concepts in plain language and provides
helpful resources for those topics.
Updates via Twitter & Facebook. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |