settings.py work in local but not on the server

40 views
Skip to first unread message

robin.l...@gmail.com

unread,
Feb 5, 2019, 12:51:02 PM2/5/19
to Django users
Hello,

It's my first time developing in Python, I'm curently working on a website using Django and I'm facing a problem when I try to configure the test serveur.
The server is hosted on gandi.net, and I'm using git to push my modifications on it. I verified using ftp, the files are correctly up to date.

When I run the code in local, everything work fine, and the settings.py is taken into account (the db is working and I see the difference when switching Debug to false).
But on the server, no matter what I do, Debug stay on True and Allowed_Host = []

The commands used to put the data on the server are :
I also tried a few time with a clean.

On the server, when trying to access a page, I got this message :
disallowedHost.PNG


The debug page on the server show this :

settings.PNG


But in settings.py :

DEBUG = False
ALLOWED_HOSTS
= ['v2.usitoo.be']


I'm still learning python and don't know what I did wrong, is it possible that something override settings.py somehow ?



Gil Obradors

unread,
Feb 5, 2019, 12:57:00 PM2/5/19
to django...@googlegroups.com
Hello Robin,
Check settings.py in server again. May be git hasn't been pushed correctly

If DEBUG= False is really in server, you must recive Bad Request (400)
You see the yellow message as DEBUG=True,


Good luck

Missatge de l'adreça <robin.l...@gmail.com> del dia dt., 5 de febr. 2019 a les 18:50:
--
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...@googlegroups.com.
To post to this group, send email to django...@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/8eee19ee-5abc-44c3-b820-5bacce886729%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeremy Mordkoff

unread,
Feb 5, 2019, 4:19:18 PM2/5/19
to django...@googlegroups.com
How is your server invoked? Is it using apache and wsgi.py ? If so, you may need to either restart the server or touch wsgi.py to force the server to byte-compile the new files. 

One trick is to put a syntax error in a file. If the server doesn't barf, then you know this is the problem.

Jeremy Mordkoff
VP &  Webmaster, www.othsl.org

 



robin.l...@gmail.com

unread,
Feb 6, 2019, 5:17:19 AM2/6/19
to Django users
Thank you both for yours answers.

Gil : 
I checked again using ftp, git pushed everything correctly, so the error don't come from that.

Jeremy :
I tried to comment the application in wsgi.py, nothing changed server-side
#application = get_wsgi_application()

Doing this, I saw that appear (cf bold) :
sent 75,631,757 bytes  received 165,829 bytes  1,783,472.61 bytes/sec
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
total size
is 74,952,802  speedup is 0.99
sending incremental file list
.gitignore
README
.md
requirements
.txt
wsgi
.py
static/images/usitoo.png
usitoo
/manage.py
usitoo
/polls/__init__.py
usitoo
/polls/{all files regarding polls}
usitoo
/usitoo/__init__.py
usitoo
/usitoo/settings.py
usitoo
/usitoo/urls.py


sent
79,452 bytes  received 811 bytes  160,526.00 bytes/sec
total size
is 76,074  speedup is 0.95
-----> Build complete
-----> Cleaning temporary files

I know wsgi.py should be by default in usitoo/usitoo/, but gandi's documentation said to put it here.
If I move it back, it is correctly place on the file list, but the error persist.

I didn't have the rsync error before, but cannot replicate that even when uncommenting back wsgi.py

I also tried to deploy like this :
ssh {xxxxxxx}@git.sd3.gpaas.net deploy default.git > output.txt 2> errors.txt
errors.txt stay empty, and I cannot put -v flag on the command

I contacted gandi's support to see if they could help.

Khushal Kumar

unread,
Feb 6, 2019, 5:34:34 AM2/6/19
to django...@googlegroups.com
Hi,

In settings.py

I use,

Try:
    from  .local_settings import *
Except ImportError:
    Pass



So, I had the same problem this morning and I realised, I didn't use the dot before local_settings.

Let me know if it helps.



Reply all
Reply to author
Forward
0 new messages