jpbruinsslot / docker-django

A project to get you started with Docker and Django.
MIT License
179 stars 62 forks source link

Nginx and Django logging #12

Closed SamuelM333 closed 7 years ago

SamuelM333 commented 7 years ago

Great template. I have been using it and it works great. How can I set up logging after it is running as a background process?

jpbruinsslot commented 7 years ago

Thanks! You can use the docker-compose to view the logs, e.g:

$ docker-compose logs -f webapp
$ docker-compose logs -f webserver

Source: https://docs.docker.com/compose/reference/logs/

SamuelM333 commented 7 years ago

Oh thanks. You should add that on the readme. Also, I was having some issues with nginx not redirecting from http to https.

SamuelM333 commented 7 years ago

Hey, that fix for the http redirecting didn't work. From the logs I see that if I request to http I'll get a 301 but no 200 after that. So looks like it is returning the 301 for redirecting but it isn't actually doing it.

jpbruinsslot commented 7 years ago

Could you try and open it in browser with "incognito mode" enabled, it seems to be a caching issue with browsers. You can also try to check if it works by using curl http://localhost.

SamuelM333 commented 7 years ago

Actually I'm using postman for the testing, so same as curl.

SamuelM333 commented 7 years ago

With curl I get:

$ curl http://localhost
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>