This Server Side Rendering app is based on Osaetin Daniel blog and built upon it. It uses:
- Front End
- Server-Side React Rendering
- Bootstrap3
- Back End
- Flask
- Flask-SQLAlchemy
- Flask-Admin
- Flask-Migrate
- Background jobs
- Celery
- Rabbitmq
- Database
- Sqlite
The Polling app has the following features:
- A basic authentication system
- Ability to vote on various topics
- Interactive progress bars to show the percentage of votes
After running the app, from your Web Browser type this link: http://127.0.0.1:5000/ and the welcome page will show the login page. Create an account and start creating polls
From the main page click on Create a Poll, create a poll and check the latest polls
Create a poll and set a timer for the duration of the poll and save the poll
There's tree tables:
topic
contains all the various topics we're going to be voting on. For example "Django vs Flask".option
contains the voting options the users can choose when voting which would be(Django or Flask)polls
serves as ajoin
table(ManyToMany relationship)between topics and options,this table is needed because of the nature of the voting system where each option can belong to more than one topic at the same time.
Use python 3.6 or higher
Clone the project via https
# git clone https://github.com/georgeerol/PollingApp.git
Run this command on the root folder to install all requirements
# pip install -r requirements.txt
from the root folder cd to the src
folder and run:
# python app.py
To run the app with celery first install homebrew then install rabbitmq with homebrew install and finally start rabbitmq
# brew install rabbitmq
# brew services start rabbitmq
then open a new terminal and then run the app
# python app.py
Download and install chocolatey and then run this following command from the command line or from PowerShell:
# choco install rabbitmq
To run rabbitMQ service, cd
to the install folder of rabbitmq, C:\Program Files\RabbitMQ Server\rabbitmq_server-3.3.4\sbin
and then run the follow command to enable the plugin
# rabbitmq-plugins.bat enable rabbitmq_management
The RabbitMQ service starts automatically. You can stop/reinstall/start the RabbitMQ service from the Start Menu.
From a new terminal cd
to the src
folder and run below command:
# celery -A tasks.celery worker --loglevel=info
Note: Start the app before running celery
When the Rabbitmq service is started you can check it at http://localhost:15672/ . The default username and password is guest.