Add Hyde WSGI application for use as development server #181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 usehyde gen
to generate a static site somewhere, and then use paste'segg:Paste#static
to serve up the static files. This is a major pain though, since I have to remember to runhyde 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:
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.