After converting all files from python 2.7 to latest version I am having issue running the game. I am getting database connection error. I have one file Frontend.py has following codes:
BIND_PORT = 7071
BIND_ADDRESS = "0.0.0.0"
MONGODB_HOST = "10.0.0.1"
MONGODB_PORT = 27017
DB_USERNAME = "tdta"
DB_PASSWORD = "foobar42"
DB_HOST = "10.0.0.1"
DB_DATABASE = "tdta"
NEW_USER_RATING = 1500
BACKEND_SERVERS = (
( "127.0.0.1", 32073, "th_frontend", "e5e6af02519f110093d76dcc1f55b25d" ),
( "127.0.0.1", 32073, "th_frontend", "e5e6af02519f110093d76dcc1f55b25d" ),
( "127.0.0.1", 32073, "th_frontend", "e5e6af02519f110093d76dcc1f55b25d" ),
)
I have another file ServerConfig.py for backend with following code:
SERVER_PORT = 32073
SERVER_FPS = 60.0 # should read back from a config file, but this will do for now
SERVER_FRAME_QUOTA = 2.0/SERVER_FPS
PING_FREQUENCY = 3.0 # once per second if nothing else
LATENCY_BUFFER_LENGTH = 10 # how many latency samples will be stored and averaged to get an average latency measurement
NONACTIVITY_GRACE_PERIOD = 300.0 # if users do absolutely nothing for this amount of seconds the match will be terminated
NONACTIVITY_WARNING_PERIOD = 240.0 # if users do absolutely nothing for this amount of seconds a warning will be sent
VISUALIZE = False
ALLOW_DEBUG = True
ALLOW_DEBUG_COMMANDS = True
MATCH_UNIT_CAP = 400
MONGODB_HOST = "10.0.0.1"
MONGODB_PORT = 27017
FRONTEND_HOST = "127.0.0.1"
FRONTEND_PORT = 7070
FRONTEND_USERNAME = "th_frontend"
FRONTEND_PASSWORD = "e5e6af02519f110093d76dcc1f55b25d"
I know this files need to configure based on my postgresql and mongodb database credentials.
Can anyone tell me what is th_frontend", "e5e6af02519f110093d76dcc1f55b25d" for? Is it postgresql username and password
I am sure this for mongodb connection:
MONGODB_HOST = "10.0.0.1"
MONGODB_PORT = 27017
DB_USERNAME = "tdta"
DB_PASSWORD = "foobar42"
DB_HOST = "10.0.0.1"
DB_DATABASE = "tdta"
But with this credential when I try to login it says no database "tdta" although i am sure mongo show dbs showing tdta.
I am confused for
BIND_PORT = 7071
BIND_ADDRESS = "0.0.0.0"
root@vps-99083:/home/Latestfiles/frontend_server# Database exception while getti ng session: TypeError('Secret key missing for non-string Cookie.',); ignored.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 862, in _handle
return route.call(**args)
File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 1729, in wrapper
rv = callback(*a, **ka)
File "/usr/local/lib/python3.6/dist-packages/bottle_sqlalchemy.py", line 155, in wrapper
rv = callback(*args, **kwargs)
File "/home/Latestfiles/frontend_server/sessions.py", line 72, in wrapper
return func(sess, user, *a, **k)
File "/home/Latestfiles/frontend_server/metrics.py", line 24, in wrapper
d = func( *a, **k )
File "frontend.py", line 915, in login
user = authenticate(db, request_dict["username"], md5(request_dict["password "]).hexdigest())
TypeError: Unicode-objects must be encoded before hashing
174.250.14.8 - - [2021-06-17 18:36:36] "POST /login HTTP/1.1" 500 885 0.157924
When trying to connect from Unity3D getting this error message now. I am still unable to figure out what is this for as mongodb and postgresql has different login credential
FRONTEND_USERNAME = "th_frontend"
FRONTEND_PASSWORD = "e5e6af02519f110093d76dcc1f55b25d"
I am getting error when trying to login with Unity3d:
root@vps-99083:/home/Latestfiles/frontend_server# Database exception while getti ng session: TypeError('Secret key missing for non-string Cookie.',); ignored.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 862, in _handle
return route.call(**args)
File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 1729, in wrapper
rv = callback(*a, **ka)
File "/usr/local/lib/python3.6/dist-packages/bottle_sqlalchemy.py", line 155, in wrapper
rv = callback(*args, **kwargs)
File "/home/Latestfiles/frontend_server/sessions.py", line 72, in wrapper
return func(sess, user, *a, **k)
File "/home/Latestfiles/frontend_server/metrics.py", line 24, in wrapper
d = func( *a, **k )
File "frontend.py", line 915, in login
user = authenticate(db, request_dict["username"], md5(request_dict["password "]).hexdigest())
TypeError: Unicode-objects must be encoded before hashing
174.250.14.8 - - [2021-06-17 18:36:36] "POST /login HTTP/1.1" 500 885 0.157924
When trying to connect from Unity3D getting this error message now.
With help from snakecharmerb I was able to fix. I changed users name and password and now able to login to postgresql database.
Now i am getting new error:
root@vps-99083:/home/Latestfiles/frontend_server# Database exception while getti ng session: TypeError('Secret key missing for non-string Cookie.',); ignored.
auth for user test1 with hash 098f6bcd4621d373cade4e832627b4f6 (got 098f6bcd4621 d373cade4e832627b4f6)
test1 authenticating with client version 0.3.0.4...
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 862, in _handle
return route.call(**args)
File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 1729, in wrapper
rv = callback(*a, **ka)
File "/usr/local/lib/python3.6/dist-packages/bottle_sqlalchemy.py", line 155, in wrapper
rv = callback(*args, **kwargs)
File "/home/Latestfiles/frontend_server/sessions.py", line 72, in wrapper
return func(sess, user, *a, **k)
File "/home/Latestfiles/frontend_server/metrics.py", line 24, in wrapper
d = func( *a, **k )
File "frontend.py", line 944, in login
d = finalizeLogin( db, session, user, clientversion, clientplatform, screenN ame=user.username)
File "frontend.py", line 443, in finalizeLogin
session.user_id = user.id
AttributeError: 'NoneType' object has no attribute 'user_id'
108.14.69.202 - - [2021-06-18 07:42:51] "POST /login HTTP/1.1" 500 885 0.365024
What should I do?My id is user1 and password user
The error message
TypeError: Unicode-objects must be encoded before hashing
is telling you that you need to encode the password before hashing it, so the line
user = authenticate(db, request_dict["username"], md5(request_dict["password"]).hexdigest())
should be
user = authenticate(db, request_dict["username"], md5(request_dict["password"].encode('ascii')).hexdigest())
(You might want to use UTF-8 as the encoding if the password could contain non-ASCII characters)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.