opengridcc / website

1 stars 10 forks source link

Website down - uwsgi naming problem #12

Closed JrtPec closed 8 years ago

JrtPec commented 8 years ago

@saroele @wouterh I need some help

Yesterday we made the website up to date with the new structure. In order to get this working, we needed to rename the website executable from opengrid.py to website.py, because we had to include imports such as from opengrid.library import houseprint and this resulted in some naming conflicts if the executable was also named opengrid.

I have altered opengrid.uwsgi.ini, changed module=opengrid to module=website, in the hope that this setting pointed uwsgi to the executable. Apparently there is more to it, because since I ran sudo service uwsgi restart opengrid the website is effectively down. @wouterh Can you perhaps help out?

wouterh commented 8 years ago

I'll try a have look somewhere in the coming days.

wouterh commented 8 years ago

@JrtPec module=website is indeed what needs changing. However, the file in the repository is only a template/example. The real config file is in /etc/uwsgi/apps-available/opengrid.ini. I changed it there too.

Now when I do service uswgi restart opengrid, I get the following in the logs (/var/log/uwsgi/app/opengrid.log):

Fri Jan 15 18:55:08 2016 - added /usr/local/src/website/ to pythonpath.
Traceback (most recent call last):
  File "/usr/local/src/website/website.py", line 11, in <module>
    from opengrid.library import houseprint
  File "/usr/local/src/website/opengrid.py", line 18, in <module>
  File "/usr/local/src/website/cache_anonymous_houseprint.py", line 19, in cache
  File "/usr/local/src/opengrid/scripts/../../opengrid/library/houseprint.py", line 40, in __init__
  File "/usr/lib/python2.7/ConfigParser.py", line 618, in get
    raise NoOptionError(option, section)
ConfigParser.NoOptionError: No option 'json' in section: 'houseprint'

Something wrong with the configuration?

JrtPec commented 8 years ago

It is fixed.

There were two problems:

The file /usr/local/src/website/opengrid.py was renamed to website.py, so opengrid.py didn't exist anymore. the .pyc files however did, so whenever I called from opengrid import ... it would try and import from that file instead of from the 'real' opengrid.

After that I got this:

Traceback (most recent call last):
  File "/usr/local/src/website/website.py", line 17, in <module>
    hp = houseprint.Houseprint()
  File "/usr/local/lib/python2.7/dist-packages/opengrid/library/houseprint/houseprint.py", line 48, in __init__
    gjson = config.get('houseprint','json')
  File "/usr/lib/python2.7/ConfigParser.py", line 618, in get
    raise NoOptionError(option, section)
ConfigParser.NoOptionError: No option 'json' in section: 'houseprint'

Which was weird because it should be importing opengrid from the folder where we have it cloned from github, this is where the config files etc. are correct. So I guess that when you install opengrid via pip it takes it from there and this causes issues. (Ideally, an opengrid developer shouldn't have opengrid installed via pip). I ran `pip uninstall opengrid' and now everything works.

JrtPec commented 8 years ago

@saroele I hope I haven't broken anything else by deinstalling opengrid via pip...

saroele commented 8 years ago

Well done jan and wouter. I'm still struggling with the diff between pip install and developer install, ideally they should not mess-up each other. I'll check if other things on the droplet are broken by the pip uninstall opengrid.

On Sat, Jan 16, 2016 at 6:08 PM, Jan Pecinovsky notifications@github.com wrote:

@saroele https://github.com/saroele I hope I haven't broken anything else by deinstalling opengrid via pip...

— Reply to this email directly or view it on GitHub https://github.com/opengridcc/website/issues/12#issuecomment-172228912.