Thursday, August 31, 2017

Re: Bizarre URL behaviour after deploying

server.modules = (
"mod_access",
"mod_accesslog",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",
"mod_scgi",
)

# Configure the logs (on USB drive)
accesslog.filename = "/mnt/passport/log/lighttpd/access.log"
accesslog.format = "%t %h %V %u \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
server.errorlog = "/mnt/passport/log/lighttpd/error.log"

# Debugging info sent to the errorlog if enabled
#debug.log-request-header = "enable"
#debug.log-condition-handling = "enable"

server.document-root = "/var/www/html"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 8000

index-file.names = ( "index.php", "index.shtml", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

$HTTP["host"] == "bernd.wechner.info" {
server.document-root = "/var/www/html/bernd.wechner.info"
}

$HTTP["host"] == "hitch-hiking.info" {
server.document-root = "/var/www/html/hitch-hiking.info"
}

$HTTP["host"] == "leaderboard.space" {
url.rewrite-once = ( "^/favicon\.ico$" => "/static/favicon.ico" )

$HTTP["url"] =~ "^/static/" {
server.document-root = "/var/www/html/leaderboard.space"
} else $HTTP["url"] !~ "^/static/" {
scgi.protocol = "uwsgi"
scgi.server = ( "/" => (( "socket" => "/var/run/lighttpd/uwsgi.socket-0", "check-local" => "disable" )), )
}
}

$HTTP["host"] == "127.0.0.1" {
url.rewrite-once = ( "^/favicon\.ico$" => "/static/favicon.ico" )

$HTTP["url"] =~ "^/static/" {
server.document-root = "/var/www/html/leaderboard.space"
} else $HTTP["url"] !~ "^/static/" {
scgi.protocol = "uwsgi"
scgi.server = ( "/" => (( "socket" => "/var/run/lighttpd/uwsgi.socket-0", "check-local" => "disable" )), )
}
}

Daniel,

it's a red herring. I agree, that's where I'd suspect the issue lies, but I'm still confident it's a red herring. But because I'm stuck even the seemingly impossible needs to be revisited I guess. It's hard to share everything about a webservers config of course in an email, but there are two files of relevance attached if it helps.

lighttp.conf is the lighttp configuration which talks to uwsgi, and uwsgi.ini is the uwsgi config that loads the django app and serves it (over a unix domain socket to lighttpd). The former is incomplete as it has includes (it gets complicated fast I guess), but the relevant section is in fact repeated to serve the domain name and the 127.0.0.1 URL as I was just testing a convergence plan after reading Tom's suggestion below (and rather than read up on "or" conditional in lighttpd confs I just duplicated the block verbatim for now.

Regards,

Bernd.

Daniel Roseman wrote:
On Thursday, 31 August 2017 10:51:22 UTC+1, Tom Evans wrote:
On Thu, Aug 31, 2017 at 2:09 AM, Bernd Wechner <bernd....@gmail.com> wrote:
> Daniel,
>
> Yes, I have deployed, that is the problem in a sense. URLs are clean in dev
> and suddenly contain an app_name when deployed.
>
> Not sure what you mean by configuration? The Django settings are here:
>
>     https://github.com/bernd-wechner/CoGs/blob/master/CoGs/settings.py
>
> The rest of the config is uwsgi under lighttpd, but none of that is likely
> to impact the appearance of an app_name in my URLs all of a sudden. I don't
> mind sharing the config files, but it's a distraction I fear.

I think you will be surprised.

I'm surprised your diagnosis doesn't point you at this straight away,
if the URLs are correct on one site but incorrect on another site, and
both sites run the exact same python/django code, then the error is
certainly in the bits that are different.

Cheers

Tom


Yes. Especially as the problem doesn't seem to be "an app name in my urls" but "a random prefix in my urls". We do need to see the lighttpd and uwsgi configs.
--
DR.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/92ba18a5-4332-493b-a268-928e1f5feabc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


No comments:

Post a Comment