• Members 1 post
    Aug. 26, 2018, 8:09 p.m.

    So first let me explain that I've had some very confusing issues but have finally got things working after a lot of lurking through the docs and discussions, some were a lot simpler like requiring Django 1.11 but also some annoying like setuptools needing to be updated and then still not grabbing the pre-req's for some reason (which caused the first issue). I would have just tried the Docker but I kept feeling like I was only one step closer to getting things working, seeing as without a virtualenv I can ./manage runserver just fine. I "wanted" the venv because gunicorn wouldn't work without one, but after a few Python versions and down/upgrades later I got to this error:

      File "/var/www/tacoland/local/lib/python3.5/site-packages/misago/categories/urls/api.py", line 2, in <module>
        from misago.core.apirouter import MisagoApiRouter
      File "/var/www/tacoland/local/lib/python3.5/site-packages/misago/core/apirouter.py", line 4, in <module>
        class MisagoApiRouter(DefaultRouter):
      File "/var/www/tacoland/local/lib/python3.5/site-packages/misago/core/apirouter.py", line 27, in MisagoApiRouter
        initkwargs={}
    TypeError: __new__() got an unexpected keyword argument 'detail'
    

    Since I had already invested so much time I figured might as well, opened up the djangorestframework API docs and briefly referenced how-to Routers (www.django-rest-framework.org/api-guide/routers/#customizing-dynamic-routes) and tried adding the detail=False flag to one and detail=True to the other and it seemed to work! Until I got another error...

      File "/var/www/tacoland/local/lib/python3.5/site-packages/misago/threads/urls/api.py", line 25, in <module>
        urlpatterns = router.urls
      File "/var/www/tacoland/local/lib/python3.5/site-packages/rest_framework/routers.py", line 101, in urls
        self._urls = self.get_urls()
      File "/var/www/tacoland/local/lib/python3.5/site-packages/rest_framework/routers.py", line 363, in get_urls
        urls = super(DefaultRouter, self).get_urls()
      File "/var/www/tacoland/local/lib/python3.5/site-packages/rest_framework/routers.py", line 291, in get_urls
        name = route.name.format(basename=basename)
    KeyError: 'methodnamehyphen'
    

    So... going back I changed 'methodnamehyphen' to 'url_path' & 'url_name' respectively and now things seem to be working.

    What did I do wrong? I'm running debian jessie w/Python 3.5, 2.7 seemed to have "other" issues not sure if they were any easier to fix... thanks!

  • Aug. 26, 2018, 9:11 p.m.
    check_box

    Marked as best answer by Aug. 27, 2018, 10:52 a.m..

    What did I do wrong?

    Your setup is using djangorestframework (3.8.2) whereas Misago is build with and tested against the djangorestframework~=3.6 (currently 3.6.4). Looks like router API has changed in either 3.7 or 3.8.

    I would have just tried the Docker

    We don't have docker setup for production use just yet. Eventually we would like to provide one for people that have VPS with docker installed and want to get their own forum
    up and running quickly and without having to experience python weirdness.

    There's docker in main repo, but that one is purely for running local development instances.

    I "wanted" the venv

    When it comes to dependencies and Python apps, you either use virtualenv, or you run your app inside container/virtual box. Otherwise you will run into dependencies clash with what you've installed globally.


    When it comes to deploying Misago, Python and Django were always a weak link - annoying to grok when done for first time, easy but still a chore when done next times, which is why I would eventually like to go all in with Docker and bash scripts for devops tasks like install/update/backup/restore.