A twitter-toy-clone frontend using Python and Flask
Project description
A toy-twitter-clone frontend using Python and Flask.
To run this Flask application,
$ pip install pytwask
$ export FLASK_APP=autopytwask
$ export PYTWASK_ENV=prod
$ flask run
1. Features
This module implements the frontend for a simplified Twitter clone based on Flask.
It supports the following features:
Register new users
Log in/out
Change user password
Get user profile
Post tweets
Follower/Following
General timeline for anonymous user
User timeline
Get tweets posted by one user
TODOs:
Search users
Delete a user
Recover user password
#hashtags
@mentions
Retweets
Replies
Conversations
Edit/Delete tweets
And more
2. Backend database
Although currently we only have Redis as the only type of backend database, we can easily switch to another type of backend database as long as the backend module conforms to the same interface as the Redis backend module pytwis.
By default this Flask application will connect to the Redis database via a TCP/IP connection. To connect to a local Redis database via a UNIX domain socket, define the environment variable REDIS_DB_SOCKET as the socket file (e.g., /tmp/redis.sock) before running the application.
$ export REDIS_DB_SOCKET="/tmp/redis.sock"
$ export FLASK_APP=autopytwask
$ flash run
Note that the UNIX domain socket is by default disabled in Redis and you need to manually enable it in the Redis configuration file (usually /etc/redis/redis.conf) before use it.
3. MTV architecture
This Flask application follows the typical Flask Model-Template-View pattern. Its directory layout follows the ones given at
Specifically,
. ├── autopytwask.py # The Flask script which creates this Flask application └── pytwask ├── auth # The authentication blueprint ├── config.py # The Flask application configuration file ├── __init__.py ├── main # The main blueprint ├── models.py # The data Model ├── static # The HTML resources (css, images, javascript) ├── templates # The HTML Templates └── tweets # The tweets blueprint
4. Development
By default, this Flask application will run in the development mode where the Flask DebugToolbar is enabled.
$ git clone https://github.com/renweizhukov/pytwask.git
$ cd pytwask
$ pip install -e .
$ export FLASK_APP=autopytwask
$ flask run
5. README.rst
README.rst is generated from README.md via pandoc.
$ pandoc --from=markdown --to=rst --output=README.rst README.md
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytwask-0.1.4.tar.gz
.
File metadata
- Download URL: pytwask-0.1.4.tar.gz
- Upload date:
- Size: 62.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cd13a4fa23637f1c54060c788fef7e90279d90ba6ebbd1fae2e469eb50ebb61 |
|
MD5 | e915d374786c64cac80891831f3f3f6a |
|
BLAKE2b-256 | 23878755f31bfdd3c9e9d77107a517f7a934f11406727d65078fbebb0a41d378 |
File details
Details for the file pytwask-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: pytwask-0.1.4-py3-none-any.whl
- Upload date:
- Size: 68.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3174e543c8783dc0ac570c0bfdb8739a9a200bf9bfb6a4f0a548a80bdb39dc25 |
|
MD5 | 7600fde85ac1c23628a9f5530889f279 |
|
BLAKE2b-256 | cb46277055a433799e586a19d04c7b473b928f421f7631843fb620bfce1c5999 |