binarymatt / pyres

a resque clone in python
http://github.com/binarydud/pyres
MIT License
955 stars 130 forks source link

pyres_web doesn't work without package_data #19

Closed mjrusso closed 14 years ago

mjrusso commented 14 years ago

When I switch to the v0.5.0 tag and install the pyres package via setup.py, pyres_web works fine.

When I switch to the current master and and install the pyres package via setup.py, pyres_web crashes when attempting to serve a page. Take a look:

$> pyres_web
itty starting up (using wsgiref)...
Listening on http://localhost:8080...
Use Ctrl-C to quit.

<type 'exceptions.IOError'> occurred on '/': [Errno 2] No such file or directory: '/Library/Python/2.6/site-packages/pyres-0.5.0-py2.6.egg/resweb/templates/overview.mustache'
Traceback: Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/itty-0.6.4-py2.6.egg/itty.py", line 225, in handle_request
    response = callback(request, **kwargs)
  File "/Library/Python/2.6/site-packages/itty-0.6.4-py2.6.egg/itty.py", line 344, in new
    return method(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/pyres-0.5.0-py2.6.egg/resweb/server.py", line 23, in index
    return str(Overview(HOST).render())
  File "build/bdist.macosx-10.6-universal/egg/pystache/view.py", line 95, in render
    template = self.load_template()
  File "build/bdist.macosx-10.6-universal/egg/pystache/view.py", line 61, in load_template
    f = open(self.template_file, 'r')
IOError: [Errno 2] No such file or directory: '/Library/Python/2.6/site-packages/pyres-0.5.0-py2.6.egg/resweb/templates/overview.mustache'
localhost - - [22/Feb/2010 00:18:09] "GET / HTTP/1.1" 500 17

This might be related to issue #12.

I added the following line to setup.py and the interface now works fine:

package_data={'resweb': ['templates/*.mustache','media/*']},
binarymatt commented 14 years ago

I put this into master and pushed up