spender-sandbox / cuckoo-modified

Modified edition of cuckoo
395 stars 178 forks source link

Web server starts...but fails when accessing #439

Closed dookgit closed 7 years ago

dookgit commented 7 years ago

Just installed everything, and most things seem to be working, but when i start the web server then browse to it i get the following:

AttributeError at /

'NoneType' object has no attribute 'upper'

Request Method: GET Request URL: http://127.0.0.1:8888/ Django Version: 1.11 Exception Type: AttributeError Exception Value:

'NoneType' object has no attribute 'upper'

Exception Location: /usr/local/lib/python2.7/dist-packages/pytz/init.py in timezone, line 163 Python Executable: /usr/bin/python Python Version: 2.7.12 Python Path:

['/home/cuckoo/cuckoo-modified/web', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/home/cuckoo/cuckoo-modified/web/..', '/home/cuckoo/cuckoo-modified/web/..', '/home/cuckoo/cuckoo-modified/web/..', '/home/cuckoo/cuckoo-modified/web/..', '/home/cuckoo/cuckoo-modified/web/..', '/home/cuckoo/cuckoo-modified/web/..', '/home/cuckoo/cuckoo-modified', '/home/cuckoo/cuckoo-modified/web', '/home/cuckoo/cuckoo-modified/web/..']

Server time:

I'm a complete noob at this stuff, but looks like it's from pytz, and not...finding, or understanding my timezone properly? I'm in Queensland, Australia. So would be AEST (+10GMT)

Or is this more a question for the pytz guys?

dookgit commented 7 years ago

So i changed /web/web/settings.py and changed

USE_TZ to True (From False) TIME_ZONE to "Australia/Brisbane" (From "None")

Soon as i re-run the web server, all good. No idea why, but....i'm working.

mallorybobalice commented 7 years ago

yep same, thanks for that

File "/usr/local/lib/python2.7/dist-packages/django/utils/timezone.py", line 79, in get_default_timezone return pytz.timezone(settings.TIME_ZONE) File "/usr/local/lib/python2.7/dist-packages/pytz/init.py", line 163, in timezone if zone.upper() == 'UTC': AttributeError: 'NoneType' object has no attribute 'upper' [25/Jul/2017 17:18:58] "GET / HTTP/1.1" 500 134465

vi web/local_settings.py

USE_TZ = True TIME_ZONE = 'UTC' after that all good

mallorybobalice commented 7 years ago

@doomedraven - should this be part of the source or only affects certain tz settings for servers aka non utc ?

ps Django (1.11.3)

doomedraven commented 7 years ago

from my experience i saw it affecting only servers in non utc, but maybe we should add it to forget about that problem at all? :)

mallorybobalice commented 7 years ago

mmm. i got a bit freaked out after upgrading libs, pylibs source and os to be honest not sure what it should be by default. guess we could set it to UTC and if people don't like it they can go set it to their own timezone ?

up to you. this is page 1 on google for pytz cuckoo. but if people assume they're all alone and it's just django+pytz it may take a while to get to here :D

doomedraven commented 7 years ago

you know what 99% of people not even do search on issues, so about google ROFL ;) but ok lets left it as it is till first NEW issue about this

redsand commented 6 years ago

came across this issue with my rhel7 deployment.

yanama123 commented 6 years ago

Hello, I am using django for my project , i have TIMEZONE='UTC' and USE_TZ=True in my settings.py file due to this in ubuntu environment time is miss matching . local time on ubuntu different than django server time . But if i use TIMEZONE=None , it will work ,but i am getting an exception saying that "settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details." please suggest me any solution to overcome this.

doomedraven commented 6 years ago

engines

# sqlite:///foo.db
# postgresql://foo:bar@localhost:5432/mydatabase
# mysql://foo:bar@localhost/mydatabase
# If empty, default is a SQLite in db/cuckoo.db.
connection = postgresql:
yanama123 commented 6 years ago

@doomedraven thanks for your kind reply , Need more clarity on this. Because I am nowhere using database so I put it in comments . Is Django expects database by default?

doomedraven commented 6 years ago

is the questions isn't related to cuckoo, read official django documentation that all depends on your project

yanama123 commented 6 years ago

okay Thanks @doomedraven Que 2: could you please share your idea on why django server time is different from local ubuntu time . I read TIMEZONE document whatever we give TIMEZONE it will showcase, but when we deploy it in customer end we may not know their TIMEZONE right ? is there anyway to fetch localtime by Django by default ?

doomedraven commented 6 years ago

No idea im django noob

yanama123 commented 6 years ago

okay thanks