Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork16
🧊 convert your dynamic django site to a static one with one line of code.
License
fabiocaccamo/django-freeze
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
django-freeze generates the static version of your django site.
Just runpython manage.py generate_static_site :)
- Generate thestatic version of your Django site, optionally compressed.zip file
- Generate/download the static site usingurls(only superuser and staff)
- Followsitemap.xml urls
- Followinternal links founded in each page
- Followredirects
- Report invalid/broken urls
- Selectivelyinclude/exclude media and static files
- Custombase url(very useful if the static site will run in a specific folder different by the document-root)
- Convert urls torelative urls(very useful if the static site will run offline or in an unknown folder different by the document-root)
- Prevent local directory index
- Run
pip install django-freeze - Add
freezetosettings.INSTALLED_APPS - Enable the
sitesframework (instructionshere) - Restart your application server
All these settings are optional, if not defined insettings.py the default values (listed below) will be used.
#the absolute path where to store the .zip and the html files#default value is a folder named 'freeze' located as sibling of 'settings.MEDIA_ROOT'FREEZE_ROOT='/...'#tells 'freeze' if the urls should be fetched using https instead of http protocol (only if FREEZE_SITE_URL is not defined)FREEZE_USE_HTTPS=False#the site-url to crawl, if not specified it will be autodetected using the sites appFREEZE_SITE_URL='http://mydomain.com'#the base-url for all links relative to root '/'#useful if the generated static site will run in a specific folder which is not the document-rootFREEZE_BASE_URL=None#if True 'freeze' will convert all absolute urls to relative urls#useful if the generated static site will run locally (file://) or in an unknown folder which is not the document-root (only if FREEZE_BASE_URL is not defined)FREEZE_RELATIVE_URLS=False#if True 'freeze' will inject a script at the end of each page#which will force hrefs like 'path/' to 'path/index.html' (only if the site is running under file://)#useful if the generated static site will run locally (requires FREEZE_RELATIVE_URLS set to True) to prevent local directory indexFREEZE_LOCAL_URLS=False#if True 'freeze' will fetch each url founded in sitemap.xmlFREEZE_FOLLOW_SITEMAP_URLS=True#if True 'freeze' will follow and fetch recursively each link-url founded in each pageFREEZE_FOLLOW_HTML_URLS=True#if true 'freeze' will send an email to managers containing the list of all invalid urls (404, 500, etc..)FREEZE_REPORT_INVALID_URLS=False#the invalid urls email report subjectFREEZE_REPORT_INVALID_URLS_SUBJECT='[freeze] invalid urls'#if True the generated site will contain also the MEDIA folder and ALL its contentFREEZE_INCLUDE_MEDIA=True#elif the value is a list or tuple only the specified directories will be includedFREEZE_INCLUDE_MEDIA= ('cache','images','videos', )#if True the generated site will contain also the STATIC folder and ALL its contentFREEZE_INCLUDE_STATIC=True#elif the value is a list or tuple only the specified directories will be includedFREEZE_INCLUDE_STATIC= ('myapp1','myapp2','myapp3', )#if True the generated site will be zipped, the *.zip file will be created in FREEZE_ROOTFREEZE_ZIP_ALL=False#the name of the zip file createdFREEZE_ZIP_NAME='freeze'#The request headers to use during the get requests that scrape the site#can be used to set Authentication headers, by default sets the user-agentFREEZE_REQUEST_HEADERS= {'user-agent':'django-freeze'}
Addfreeze.urls tourls.py if you want superusers and staff able to use freeze urls.
urlpatterns=patterns('', ...url(r'^freeze/',include('freeze.urls')), ...)
Runpython manage.py generate_static_site
Superusers and staff can use the following urls todownload a .zip containing the generated static site or to just generate the static website.
/freeze/download-static-site/
/freeze/generate-static-site/
(the time necessary to generate the static site depends on the size of the project)
- Write tests
- Add
sitemap.xmlandrobots.txtto the generated static site
# clone repositorygit clone https://github.com/fabiocaccamo/django-extra-settings.git&&cd django-extra-settings# create virtualenv and activate itpython -m venv venv&&. venv/bin/activate# upgrade pippython -m pip install --upgrade pip# install requirementspip install -r requirements.txt -r requirements-test.txt# install pre-commit to run formatters and linterspre-commit install --install-hooks# run teststox# orpython runtests.py# orpython -m djangotest --settings"tests.settings"
Released underMIT License.
django-admin-interface- the default admin interface made customizable by the admin itself. popup windows replaced by modals. 🧙 ⚡django-cache-cleaner- clear the entire cache or individual caches easily using the admin panel or management command. 🧹✨django-colorfield- simple color field for models with a nice color-picker in the admin. 🎨django-extra-settings- config and manage typed extra settings using just the django admin. ⚙️django-maintenance-mode- shows a 503 error page when maintenance-mode is on. 🚧 🛠️django-redirects- redirects with full control. ↪️django-treenode- probably the best abstract model / admin for your tree based stuff. 🌳python-benedict- dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘python-codicefiscale- encode/decode Italian fiscal codes - codifica/decodifica del Codice Fiscale. 🇮🇹 💳python-fontbro- friendly font operations. 🧢python-fsutil- file-system utilities for lazy devs. 🧟♂️
About
🧊 convert your dynamic django site to a static one with one line of code.
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.