Coder Social home page Coder Social logo

alireza01100011 / arash-blog Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 23.16 MB

A Blog Coded In Flask With Simple Setup

License: GNU General Public License v3.0

Python 53.21% JavaScript 46.72% Shell 0.08%
docker docker-compose flask flask-sqlalchemy mysql nginx python-3 redis

arash-blog's Introduction

Arash Blog

Content management system with Flask


My goal in this project is just to have fun and learn new things, that's why I think it needs extensive optimizations. I hope that my time will help me and I can optimize this project and solve its various problems, I will be very happy if you take a look at the codes and make them better, thank you, friend.

[note: Basic optimizations in the database section, especially website information, must be done]

Images of the software environment:

HomePage



Posts-Page Post-Page

Profile-Page AdminPanel-Page



Description and purpose of this project


English :

This project is a blog with common features and obvious and hidden weaknesses!

The goal of this project is to create a medium-sized project with Flask, and at this stage, without security developments,
 it is not ready to be used in a high-risk production environment.
(Here I mean high-risk areas where hackers are constantly trying to hack your service)

But yes, it can be used for normal environments!

I am trying to create a regular update cycle to continuously make the code better and safer!

I would be happy if you look at the codes and help me! thanks a lot


Persian:

این پروژه یک وبلاگ با امکانات رایج و نقطه ضعف هایی اشکار و پنهان است !

هدف این پروژه پیدا سازی یک پروزه متوسط با فلسک بوده و در این مرحله بدون توسعه هایی امنیتی آمادگی استفاده در محیط پروداکشن پر خطر رو را نداره 
(در اینجا منظور من از پر خطر حوضه هایی است که هکر ها مدام قصد هک کردن سرویس شما رو دارن )

اما برای محیط های معمولی بله میشه استفاده کرد !

من دارم سیع میکنم یک سیکل اپدیت منظم ایجاد کنم تا به صورت مستمر کدهارو بهتر و امن تر کنم !

خوشحال میشم شما هم به کدها نگاهی کنید و به من کمک کنید! خیلی ممنونم 



Technical


Technologies used in this WebApplication (docker-compose) :



Database Models


Note : 
  ORM (flask-sqlalchemy) is used to communicate with the database.
  In the version (0.9), I adapted the codes related to the database with MySQL,
    before that I used to develop the project with SQLlite.

I tried my best to use the relationships in the database optimally, but I believe there are better solutions!
I would be happy if you have any comments...





Tables (SITE, INDEXPAGE)


Tables (SITE) and (INDEXPAGE) are used for website settings. I know this method is like a joke,
 but I will soon replace it with another method and these tables will be deleted!

Databse-SettingSite

Tables (The rest of the tables)

The rest of the tables are essential tables

File address: './Docts/DataBaseModel.drawio'

Databse

Simple execution model in Docker

In this image, I tried to simplify the Docker Compose file for modern development.

It is quite obvious that you can create a more complex structure with multiple instances of a container and
 make the application scalable, as I have tried to make this possible.

An example of my effort:
 creating a common space for storing application files (user and media profiles) see all examples and web server (nginx)
   "because these files are handled by nginx to optimize traffic"

File address: './Docts/SimpleDocker.drawio'

Dacker

Use and setup

Common steps :

  • Download the latest version of the software Click here
  • CD To Directory, './Application'
  • Copy .env.example to .env
  • Configure the .env file
    • "Almost all settings are in this file"

Docker-Compose (recommendation):

note : The engineering settings in Docker Compose are in this direction : ./Application/Docker/nginx.conf.template

  • $docker-compose up -d

  • Database migration:

    • Creating tables in the database :
    • $ docker exec {Application_Name} bash -c "python3 manage.py create-db"
    • Create the first admin user :
    • $ docker exec {Application_Name} bash -c "python3 manage.py create-admin {FullName} {Email} {PassWord}"

    note : Application_Name = container-id or ($APP_CONTAINER_NAME in to .env)


Without Docker:

  • Start a MySQL

  • Start a Redis

  • Start a Nginx

  • Configure the .env file

  • Database migration:

    • Creating tables in the database :
    • $python3 manage.py create-db
    • Create the first admin user :
    • $python3 manage.py create-admin {FullName} {Email} {PassWord}
  • Run the project with (gunicorn).

    • $gunicorn -b '{IP}:{PORT}' app:app
  • Configure your service nginx : The goal is a reverse proxy to our (gunicorn) and other settings.

  • Restart service Nginx


⚠️ My recommendation is to use Docker-Compose to run !


In the future, the documentation will be more and more detailed ....

arash-blog's People

Contributors

arman-async avatar alireza01100011 avatar

Watchers

 avatar

Forkers

arman-async

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.