Moved documentation to the GitHub Wiki
This commit is contained in:
parent
fd5f4ce57d
commit
cea93cbf34
137
Apache.md
137
Apache.md
|
@ -1,137 +0,0 @@
|
||||||
# Apache Configuration
|
|
||||||
|
|
||||||
Here's some tips on getting Rophako set up on Apache.
|
|
||||||
|
|
||||||
# mod\_wsgi
|
|
||||||
|
|
||||||
For simple sites you can set it up with `mod_wsgi` in Apache.
|
|
||||||
|
|
||||||
## Apache configuration:
|
|
||||||
|
|
||||||
```apache
|
|
||||||
<VirtualHost *:80>
|
|
||||||
ServerName www.example.com
|
|
||||||
WSGIDaemonProcess rophako user=www-data group=www-data threads=5 home=/home/www-data/git/rophako
|
|
||||||
WSGIScriptAlias / /home/www-data/git/rophako/app.wsgi
|
|
||||||
WSGIScriptReloading On
|
|
||||||
CustomLog /home/www-data/logs/access_log combined
|
|
||||||
ErrorLog /home/www-data/logs/error_log
|
|
||||||
|
|
||||||
<Directory /home/www-data/sites/rophako>
|
|
||||||
WSGIProcessGroup rophako
|
|
||||||
WSGIApplicationGroup %{GLOBAL}
|
|
||||||
Order allow,deny
|
|
||||||
Allow from all
|
|
||||||
</Directory>
|
|
||||||
</VirtualHost>
|
|
||||||
```
|
|
||||||
|
|
||||||
## app.wsgi
|
|
||||||
|
|
||||||
A copy of `app.wsgi` is included in the git repo's root. Here it is though for reference. This assumes you're
|
|
||||||
using a Python virtualenv named "rophako":
|
|
||||||
|
|
||||||
```python
|
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
"""WSGI runner script for the Rophako CMS."""
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Add the CWD to the path.
|
|
||||||
sys.path.append(".")
|
|
||||||
|
|
||||||
# Use the 'rophako' virtualenv.
|
|
||||||
activate_this = os.environ['HOME']+'/.virtualenv/rophako/bin/activate_this.py'
|
|
||||||
execfile(activate_this, dict(__file__=activate_this))
|
|
||||||
|
|
||||||
from rophako import app as application
|
|
||||||
|
|
||||||
# vim:ft=python
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
# mod\_fcgid and mod\_rewrite
|
|
||||||
|
|
||||||
For kirsle.net I needed to set it up using `mod_fcgid` because my site has a lot
|
|
||||||
of legacy URLs to old static files, so Rophako needs to serve the main website
|
|
||||||
pages and Apache needs to serve everything else.
|
|
||||||
|
|
||||||
## Apache configuration:
|
|
||||||
|
|
||||||
```apache
|
|
||||||
# Rophako www.kirsle.net
|
|
||||||
<VirtualHost *:80>
|
|
||||||
ServerName www.kirsle.net
|
|
||||||
DocumentRoot /home/kirsle/www
|
|
||||||
CustomLog /home/kirsle/logs/access_log combined
|
|
||||||
ErrorLog /home/kirsle/logs/error_log
|
|
||||||
SuexecUserGroup kirsle kirsle
|
|
||||||
|
|
||||||
<Directory "/home/kirsle/www">
|
|
||||||
Options Indexes FollowSymLinks ExecCGI
|
|
||||||
AllowOverride All
|
|
||||||
Order allow,deny
|
|
||||||
Allow from all
|
|
||||||
</Directory>
|
|
||||||
|
|
||||||
<Directory "/home/kirsle/www/fcgi">
|
|
||||||
SetHandler fcgid-script
|
|
||||||
Options +ExecCGI
|
|
||||||
AllowOverride all
|
|
||||||
Order allow,deny
|
|
||||||
Allow from all
|
|
||||||
</Directory>
|
|
||||||
</VirtualHost>
|
|
||||||
```
|
|
||||||
|
|
||||||
## .htaccess configuration:
|
|
||||||
|
|
||||||
This goes in `~/www/.htaccess`
|
|
||||||
|
|
||||||
```apache
|
|
||||||
<IfModule mod_rewrite.c>
|
|
||||||
RewriteEngine on
|
|
||||||
RewriteBase /
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
|
||||||
RewriteRule ^(.*)$ /fcgi/index.fcgi/$1 [QSA,L]
|
|
||||||
RewriteRule ^$ /fcgi/index.fcgi/ [QSA,L]
|
|
||||||
</IfModule>
|
|
||||||
```
|
|
||||||
|
|
||||||
## FastCGI script
|
|
||||||
|
|
||||||
This is my FastCGI script I wrote to launch Rophako. Important things to note:
|
|
||||||
|
|
||||||
* The shebang line points to the Python binary in my virtualenv.
|
|
||||||
* I modify sys.path and chdir to my git checkout folder for Rophako.
|
|
||||||
* The `ScriptNameStripper` allows `mod_rewrite` to work best. Without it you'll
|
|
||||||
sometimes get URL paths like `/fcgi/index.fcgi/blog/entry/...` etc. from Flask
|
|
||||||
because that's what it thinks its path is.
|
|
||||||
|
|
||||||
```python
|
|
||||||
#!/home/kirsle/.virtualenv/rophako/bin/python
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
sys.path.append("/home/kirsle/git/rophako")
|
|
||||||
os.chdir("/home/kirsle/git/rophako")
|
|
||||||
|
|
||||||
from flup.server.fcgi import WSGIServer
|
|
||||||
from rophako import app
|
|
||||||
|
|
||||||
class ScriptNameStripper(object):
|
|
||||||
def __init__(self, app):
|
|
||||||
self.app = app
|
|
||||||
|
|
||||||
def __call__(self, environ, start_response):
|
|
||||||
environ["SCRIPT_NAME"] = ""
|
|
||||||
return self.app(environ, start_response)
|
|
||||||
|
|
||||||
app = ScriptNameStripper(app)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
WSGIServer(app).run()
|
|
||||||
```
|
|
91
README.md
91
README.md
|
@ -12,94 +12,15 @@ and a couple other small sites.
|
||||||
Check out Rophako's official homepage and example site:
|
Check out Rophako's official homepage and example site:
|
||||||
[rophako.kirsle.net](http://rophako.kirsle.net/)
|
[rophako.kirsle.net](http://rophako.kirsle.net/)
|
||||||
|
|
||||||
# Installation
|
# Documentation
|
||||||
|
|
||||||
`pip install -r requirements.txt`
|
For all documentation, including installation, configuration and how to build
|
||||||
|
your own site using the Rophako CMS, please see
|
||||||
These may need to be installed for the dependencies to build:
|
[the Rophako Wiki on GitHub](https://github.com/kirsle/rophako/wiki).
|
||||||
|
|
||||||
**Fedora:** `libffi-devel libjpeg-devel libpng-devel`
|
|
||||||
|
|
||||||
# Server Configuration
|
|
||||||
|
|
||||||
Instructions and tips are currently available for the Apache web server.
|
|
||||||
See [Apache.md](https://github.com/kirsle/rophako/blob/master/Apache.md) for
|
|
||||||
information.
|
|
||||||
|
|
||||||
Copy the file `config-sample.py` as a file named `config.py`, and edit
|
|
||||||
its contents to set up your site. It's very important that you change the
|
|
||||||
`SECRET_KEY` variable, as this is used to sign the session cookies and
|
|
||||||
prevent people from tampering with them. The config script is well-documented
|
|
||||||
with comments explaining what all the options do.
|
|
||||||
|
|
||||||
## Plugins
|
|
||||||
|
|
||||||
The various site features in Rophako are delegated out into pluggable
|
|
||||||
modules. Your `config.py` should call a `load_plugin()` method for each
|
|
||||||
plugin you want your site to use.
|
|
||||||
|
|
||||||
The core plugins `admin` and `accounts` are *always* loaded automatically.
|
|
||||||
The other built-in plugins like `blog`, `photo`, and `comment` are optional
|
|
||||||
but are enabled by default in the sample config file.
|
|
||||||
|
|
||||||
Each of the built-in plugins are loaded as Flask blueprints, and the plugin
|
|
||||||
specifies where it attaches its endpoint to within its own code, i.e. the
|
|
||||||
blog plugin will attach to the `/blog` URI. For loading the built-in plugins
|
|
||||||
in your site, just refer to them by name:
|
|
||||||
|
|
||||||
```python
|
|
||||||
load_plugin("rophako.modules.blog")
|
|
||||||
```
|
|
||||||
|
|
||||||
Plugins are assumed to be Flask blueprint modules, which use the variable
|
|
||||||
name `mod` to hold their Blueprint object. If your plugin isn't a blueprint,
|
|
||||||
and you simply want it to be imported and run (i.e. perhaps it manipulates
|
|
||||||
the `app` object directly to specify its endpoints), use the parameter
|
|
||||||
`as_blueprint=False`. An example of this is with `kirsle_legacy.py` which
|
|
||||||
defines legacy endpoints for kirsle.net for backwards compatible URIs:
|
|
||||||
|
|
||||||
```python
|
|
||||||
load_plugin("kirsle_legacy", as_blueprint=False)
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally, blueprint plugins can keep their own templates bundled within their
|
|
||||||
module's folder. All of the built-in plugins do this -- it means that, for
|
|
||||||
example, if you elect *not* to include the `photo` plugin, that the endpoints
|
|
||||||
for its URIs (i.e. `/photos/album`) will give 404 responses.
|
|
||||||
|
|
||||||
You can specify the template path for your blueprint's templates as a
|
|
||||||
`template_path` parameter to `load_plugin()`. By default, the module's name
|
|
||||||
is converted into a path and a `/templates` folder is appended. So for
|
|
||||||
example, the blog's template path becomes `rophako/modules/blog/templates`.
|
|
||||||
This works fine for built-in modules (as your working directory will be the
|
|
||||||
root of your Flask application), but hasn't been tested for third party
|
|
||||||
modules.
|
|
||||||
|
|
||||||
# Create the Admin User
|
|
||||||
|
|
||||||
Once the web app is up and running, navigate to the `/account/setup` URL
|
|
||||||
to create the admin user account. Once the admin account has been created,
|
|
||||||
the `/account/setup` path can't be used anymore. Additional user accounts
|
|
||||||
can be created by the admin users at the `/admin` URL.
|
|
||||||
|
|
||||||
# Building Your Site
|
|
||||||
|
|
||||||
Rophako has a dual templating system. When the Rophako CMS wants to render
|
|
||||||
a template (for example, `blog/entry.html`), it will look inside your
|
|
||||||
`SITE_ROOT` path first for that template, before falling back to the default
|
|
||||||
site templates inside the `rophako/www` path.
|
|
||||||
|
|
||||||
All of the core features of Rophako (user account, blog, photo albums,
|
|
||||||
comments, etc.) exist in the default site, so the CMS is already fully
|
|
||||||
functional out-of-the-box. You can override files in the default site by
|
|
||||||
putting files with the same name in your `SITE_ROOT` folder. For example,
|
|
||||||
the default `SITE_ROOT` is set to the "site/www" folder in the git repo, and
|
|
||||||
if you put a file at `site/www/layout.html` there, it will change the web
|
|
||||||
design template for the Rophako site. A file at `site/www/index.html` will
|
|
||||||
change the index page of your site away from the default.
|
|
||||||
|
|
||||||
# Copyright
|
# Copyright
|
||||||
|
|
||||||
|
```
|
||||||
Rophako CMS
|
Rophako CMS
|
||||||
Copyright (C) 2014 Noah Petherbridge
|
Copyright (C) 2014 Noah Petherbridge
|
||||||
|
|
||||||
|
@ -116,4 +37,4 @@ change the index page of your site away from the default.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user