Build out a static version of your website.
Build out a static version of your django project and deploy it using ftp, ssh or on your localhost.
But at first … if you like this tool and the idea behind, feel free to fork it, make pull requests and write issues.
If you’re using Ubuntu this should work:
sudo pip install django-statify
Additionally, you need the python driver for your selected database:
sudo aptitude python-psycopg2 or sudo aptitude install python-mysql
This will your database’s driver globally.
sudo pip install django-statify (see above at ubuntu)
I recommend using SQLite, MySQL or PostgreSQL.
Add the following app to your INSTALLED_APPS.
to your urls.py and run
python manage.py syncdb --all
At last you have to set the current host at your Sites in the Admin Interface.
Default there is an exmaple host like:
Domain name: example.com Display name: Domain
this should be something like this
Domain name: Your current host, e.g. 127.0.0.1:8000 Display name: Localhost or something else
The domain name is important because of the internal url validation.
This is your settings file for the release.
It should looks like the following example:
# -*- coding: utf-8 -*- # # Project imports from conf.settings import * DEBUG = False STATIFY_ROOT_STATIC_URL = '/'
IF you are using django-cms you have to set this True:
STATIFY_USE_CMS = True
Now your CMS sites will be automatically saved in internal urls.
The project dir should be the absolute path to your django project, where your manage.py is stored.
The upload path is relative to the MEDIA_ROOT. There will be stored all release archives. This should be always an absolute path.
[u'admin', u'statify', u'tmp', u'root']
If you need some root files like robots.txt or crossdomain.xml you are able to store these files in this path. On release these files will be moved to the root of the final htdocs.
This setting is important for development. It should be overwritten in your build settings to ‘/’.
settings.STATIC_URL + 'root/'
You can register internal url’s using the django admin backend.
Alternative you can register urls automatically by adding one of the below methods to your model classes.
The following example is for an single URL:
def statify_url(self): return u'/%s/' % self.url_field
or you can register more then one URL for a Model with the following example:
def statify_urls(self): url_list = list() url_list.append('/%s/' % self.locale) return url_list
The backend will validate the url on save. Only valid urls will be rendered. This is important because only valid urls will be rendered on release.
If you need some external content rendered to your site, you are able to register external urls. Use the target path to point the rendered file in your final htdocs folder.
Using the django admin interface you can create new releases by clicking the button “Create new release” at the release overview. After clicking you will see a loader. After the release is done the current page will reload automatically.
There are two ways to deploy an release. First you have to click at the release overview on “Deploy this release”. Afterwards you have to select an deployment host and click on “Run deployment”.
Alternative you can navigate to the detail view of an release and do the same like below by clicking on “Run deployment”.