This directory contains two games chat applications: one with and one without TalkJS integrated.
The application without chat functionality serves as a start application for the TalkJS implementation tutorial, in which chat functionalities are being added within a project. The final product of the tutorial is the games chat application with chat functionality.
Make sure you're working with Python 3.7.4 or above. You can download it from here.
Make sure you tick the box that says 'Add Python to PATH'.
Make sure you're working with PostgreSQL 11.6 or above. You can download it from here.
Through the installation you will be asked to enter a password for your database. In this example the password gameschat
is used, but you can write whatever you want, just make sure to remember it because you will need it later.
The following steps should be executed in either the gameschat-with-talkjs
or gameschat-without-talkjs
directory.
-
After the installation of PostgreSQL is done, start the
pgAdmin
which will open the database in your browser. Enter the password you chose during the installation. Expand the Servers section from theBrowser
on the right (if asked enter the same password again). Right click onDatabases->Create->Database...
, then enter the name you want and clickSave
. -
Navigate to the installation directory of PostgreSQL, then the version folder and finally into the bin folder. Copy the path (should be something like this on Windows:
C:\Program Files\PostgreSQL\11\bin
) and add it to the PATH environment variable. -
Open the terminal and write
python
. Then writeimport secrets
, hit enter and on the new line writesecrets.token_hex(16)
. Copy the result string and save it. -
Add environment variables:
- Variable name:
DEBUG_VALUE
. Variable value:True
. - Variable name:
PGNAME
. Variable value: the name of the database you chose in the previous steps. This example usesgameschat
as password and database name. - Variable name:
PGPASSWORD
. Variable value: the password you chose during the installation of PostgreSQL. This example usesgameschat
as password and database name. - Variable name:
PGUSER
. Variable value:postgres
. - Variable name:
SECRET_KEY
. Variable value: the result string from the terminal we generated earlier.
- Variable name:
-
Restart your PC.
-
After you've cloned/downloaded the repository, open the terminal in the project's directory and write
pip install -r requirements.txt
. After the installation is done, writepython manage.py migrate
. Lastly, writepython manage.py runserver
, this will start the server on port 8000. Go ahead and write the following in your browserhttp://localhost:8000
.
Good job! Additional information can be found in the tutorial of this application.
For more information on how to integrate TalkJS into your projects, check out our documentation.