Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hyde WSGI application for use as development server #181

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

clj
Copy link

@clj clj commented May 21, 2012

I have a scenario where having a WSGI application serving up my Hyde site would be super handy. Note that this is for development only and for the live instance of all this the hyde gen command is obviously used to generate a static site.

I have three different components that work together to form a complete website. Mostly the site consists of a bunch of static pages generated using Hyde, which live in the root (/) of the site. I then have a web application (WSGI app) which is mounted on, say, /app. This application uses the CSS and JavaScript, and a few HTML files which are generated by Hyde (i.e. the application expects to get a stylesheet or javascript generated by hyde when accessing the /css or /js directories).

The current hyde serve command starts a SimpleHTTPServer based webserver in which I can't attach a WSGI application, which means that my Hyde sites is served on one port and the WSGI app is served on another port (using Paste) and the application's requests to /css or /js result in 404s. My solution to this was initially to use hyde gen to generate a static site somewhere, and then use paste's egg:Paste#static to serve up the static files. This is a major pain though, since I have to remember to run hyde gen every time I change anything.

The ideal situation would be mounting the Hyde server as a WSGI application, as it would then be possible to do the following using Paste:

[composite:main]
use = egg:Paste#urlmap
/ = home
/app = app

[app:home]
use = egg:hyde
site = /path/to/hyde/site

[app:code]
use = config:development.ini

making the development site work exactly like the live site, but served up using paster serve.

As an added bonus the WSGI application can also be used to serve up the Hyde site in the normal way, using hyde serve, by using the wsgiref module, so that there will only be one development server that needs to be maintained.

I have some code that implements a Hyde WSGI application and I will attach a diff to the ticket shortly. If and when a satisfactory changeset is generated I can turn it into a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant