A new version of MyBlog without commenting and liking systems but using Django with web sockets.
it can run online through AWS or locally.
-
clone or download the repo:
$ git clone https://github.com/petersobhi/MyBlog2.git
-
create a virtual environment with
python3
and activate it$ virtualenv {location} --python=python3 $ source {location}/bin/activate
-
upgrade pip and install requirements while virtual environment is activated:
$ pip install --upgrade pip $ pip install -r {repo}/requirements.txt
-
configure the database:
-
install MySQL
$ sudo apt-get update $ sudo apt-get install mysql-server $ mysql_secure_installation
-
create a database in MySQL
-
edit
DATABASES
dict insettings.py
with the MySQL username, password and database name -
make the migrations:
$ python manage.py makemigrations $ python manage.py migrate
-
-
now you have to run two processes concurrently
$ python manage.py runworker
and:
$ daphne -b {{ip_address}} -p {{port_number}} {{project_namee}}.asgi:channel_layer
you can use Supervisor to do so. note that you can configure Supervisor to run the
runworker
task mare than once which is recommended.