License: MIT
brew install postgresql@15 # for Mac
apt install postgresql # for Linux
sudo pacman -S postgresql # for Arch Linux
PostgreSQL Download # for Others
Open postgresql command line tool
psql -U postgres
Create database
postgres=# CREATE DATABASE chatbot;
Connect database
postgres=# \c chatbot
Exit postgresql command line tool
postgres=# \q
To open the Python Environment:
source env/bin/activate # for Linux/Mac
source .\venv\Script\activate # for Windows
To close the Python Environment:
deactivate
Once the Python environment is open run:
pip install -r requirements/local.txt
This install Django and all the required files need to run the program.
Run the server with:
$ python manage.py runserver
Open your browser at http://localhost:8000
to access the chatbot.
Run static files with:
$ python manage.py collectstatic
Create migrations with:
$ python manage.py makemigrations
Apply migrations with:
$ python manage.py migrate
To create a normal user account, simply go to the Sign Up page and fill out the form. Once you submit it, you will see a "Verify Your E-mail Address" page. Open your console to see a simulated email verification message. Copy the link into your browser, and now your user's email should be verified and ready to use.
To create a superuser account, run this command:
$ python manage.py createsuperuser
To check your code for type errors, run mypy
:
$ mypy chatbot
To run your tests, first run the test command and then generate an HTML coverage report:
# Run tests with pytest
$ pytest
# Check test coverage
$ coverage run -m pytest
# Generate HTML coverage report
$ coverage html
# Open HTML coverage report
$ open htmlcov/index.html
To log into the admin backend, go to http://localhost:8000/admin
in your browser and enter the username and password you set up when creating a superuser account.