Coder Social home page Coder Social logo

roshnet / blogstate Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 4.0 427 KB

Home Page: https://blogstate.pythonanywhere.com

License: GNU General Public License v3.0

Python 56.61% HTML 28.63% TSQL 14.76%
python flask mysql werkzeug jinja2 pythonanywhere

blogstate's Introduction

blogstate

A blogging platform for wannabe bloggers.

Current production environment

Site hosted (beta) at https://blogstate.pythonanywhere.com

Setup Locally

Here's how.

It is assumed that you have mysql-server and mysql-client configured. If not, install them by sudo apt install mysql-server mysql-client and set a password in the prompt asked.

Using pipenv

  1. Clone the repo (or fork if you plan to contribute).

    • To just test the site: git clone https://github.com/roshnet/blogstate
    • To enable contributions and send PRs: git clone <url-of-fork>
  2. Install pipenv if not already by pip install pipenv. After installing it, cd to the cloned repository, and run pipenv install to install all dependencies.

  3. Now, the Python part is all set up. The database needs to be configured.

  4. Copy all contents of dbconfig/setup.sql to clipboard.

  5. Run sudo mysql -u root -p and enter the MySQL password, which you entered during installation of MySQL Server ("root" is default, it may be something else on your machine).

  6. In the mysql console, paste what you copied from setup.sql, and execute it. Things may become easier if there's a database manager tool, like phpMyAdmin or something.

  7. Now, the database is setup along with the required table(s).

  8. Run python app.py to start the development server.

  9. Links maybe broken since it's under development. So, manually change the URL to whatever route you like. Refer to app.py for all routes, and manually change the URLs to navigate. For example, change the URL to 127.0.0.1:5000/signup to view the signup page.

Using traditional virtual environment

  1. Follow step-1 from above (clone/fork).
  2. cd to your favourite directory, and run python3 -m venv bs-env.
  3. Activate it by source bs-venv/bin/activate. You may use any other name than bs-venv, but the same name.
  4. Run pip install --upgrade pip to, as expected, upgrade pip, and then install the dependencies by:

pip install flask flask-login flask-mysql

  1. Now cd to the cloned blogstate directory, and run python app.py (ensure venv is activated).
  2. The project can run only when the environment is activated. Or perhaps you have the dependencies globally installed.

Useful links

blogstate's People

Contributors

dependabot[bot] avatar pnijhara avatar roshnet avatar

Stargazers

 avatar  avatar

blogstate's Issues

Error redirected-too-many-times when logging in after logout

After logging out, the user is redirected to /logout. The template rendered is login.html.

However, on trying to log in now, the browser shows the typical too-many-redirects error.

Plus, the route at that moment is that of the dashboard of the previous user (last login).

The latter is a serious security issue, needing a quick fix.

500 Internal Server Error when site goes idle

When being used frequently, the /public/articles route works perfectly as expected.

However, when attempts to view it are made after a not-so-long idle time, it results in 500 Internal Server Error.
The error logs on the production server told a pymysql.err.InterfaceError: (0, '') happening on it's end.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.