Opened 9 years ago

Closed 9 years ago

#5459 closed defect (fixed)

Relative URLs on pages often mis-formed

Reported by: cpence Owned by:
Priority: major Milestone:
Component: programming Keywords:
Cc: Parent Tickets:

Description

On my MG installation (0.9.0, Python 3), the relative pagination links seem to be mis-formed.

  • On the front page (Recent Media), they are of the form "?page=3", which doesn't work.
  • On collection pages, they are of the form "u/username/collection/coll/?page=2", missing the leading slash, which also doesn't work.

Change History (6)

comment:1 by cpence, 9 years ago

Sorry, I'm new to the formatting here. The front page links are of the form "//?page=3".

comment:2 by ayleph, 9 years ago

How are you running MediaGoblin? Are you using lazyserver, or some webserver? My first guess would be that if you're running via a webserver + fastcgi, the location configured in your webserver is missing a trailing slash.

comment:3 by cpence, 9 years ago

I'm running via UWSGI. All the configs basically identically match those up on the MG wiki (except I tossed PYTHON_EGG_CACHE into /tmp to fix a weird Python error). No changes to paste.ini, either.

nginx:

 # Mounting MediaGoblin itself via uwsgi
 location / {
    uwsgi_pass unix:///tmp/mg.uwsgi.sock;
    uwsgi_param SCRIPT_NAME "/";
    include uwsgi_params;
 }

uwsgi:

uwsgi:
 uid: mediagoblin
 gid: www-data
 socket: /tmp/mg.uwsgi.sock
 chown-socket: mediagoblin:www-data
 plugins: python
 home: /path/to/mediagoblin/
 chdir: /path/to/mediagoblin/
 ini-paste: /path/to/mediagoblin/paste.ini
 env: PYTHON_EGG_CACHE=/tmp

comment:4 by ayleph, 9 years ago

I see there's a difference in the SCRIPT_NAME parameter between the official documentation for nginx + fastcgi and the wiki docs for nginx + uwsgi.

From the latest docs:

 # Mounting MediaGoblin itself via FastCGI.
 location / {
    fastcgi_pass 127.0.0.1:26543;
    include /etc/nginx/fastcgi_params;

    # our understanding vs nginx's handling of script_name vs
    # path_info don't match :)
    fastcgi_param PATH_INFO $fastcgi_script_name;
    fastcgi_param SCRIPT_NAME "";
 }

From the wiki:

    location / {
                uwsgi_pass unix:///tmp/mg.uwsgi.sock;
                uwsgi_param SCRIPT_NAME "/";
                include uwsgi_params;
        }

Notice that in the fastcgi config, SCRIPT_NAME is an empty string. Can you try that with your uwsgi config and see if it makes a difference?

comment:5 by cpence, 9 years ago

Aha, that takes care of both issues. Nice catch. Probably the next version of the official docs should just be upgraded to recommend UWSGI, since flup doesn't run on Python 3. I'd be glad to draft that, even, if I knew where the docs sources were and how to open a docs-patch-ticket.

comment:6 by ayleph, 9 years ago

Resolution: fixed
Status: newclosed

Glad that fixed the issue. I've updated the wiki to remove the slash in the uwsgi config example. I'm going to go ahead and close this ticket since the issue is now resolved.

You're welcome to create a new ticket for adding UWSGI configuration to the documentation. If you'd like to submit some text, you have a couple of options for doing so. First, you could simply write up some text to drop in the ticket. Second, and more helpful, you could upload a git format-style patch to the ticket with changes to the deployment documentation source which can be found at /path/to/mediagoblin/docs/source/siteadmin/deploying.rst.

Note: See TracTickets for help on using tickets.