[PY 3.6+] Trinity-py - A flask based CMS for Python 3.6+

Status
Not open for further replies.

Awixe

New Member
Nov 4, 2017
2
2
Didn't know what that was untill now, thanks for the suggestion i'll definitely be looking into it
Its used to run tests every time a pull request is submitted if the test passes that means the pull request will not interfere with the rest of your code, CodeCov is used to determine how much of your project is being test. The higher percentage the better. So if your project fails you can locate the error with the tests meaning Travis will tell you what part of your code is failing without downloading the whole project to your computer and hand testing them yourself.
 
Last edited:

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
Project has been rewritten from scratch and will be rolling once again


k8I15Gh.png

(Older sources have been moved to other branches.)
New Objective
Flask, as fast as you can. Finish intended features.


Committed changes (after reset)
  • gzip support (flask compress)
  • pymysql wrapper rewrite
  • jinja2 caching
  • removed automatic controller imports in favor of fixed/static routes (see )
  • complete rewrite of structure
  • live demo available at

Agenda
  1. restore admin panel from old branches for rewrite
  2. finish cms/server management in admin panel
  3. add json db support (probably going to be rethinkdb)
  4. further improve speed and lower footprint
  5. re-create a first-time config generator

Direct download:

LEAoZw8qT2iY6Ewrr0gfYw.png

 
Committed changes (Dec, 29, 2017)
  • Started config manager


(old)
lRuNBjosR52_1iwfrgBhnw.png



(new)
PfTMel0MRa_HTfPDNg48HQ.png
  • added middlewares directory and started csrf middleware
YnETGnPOS0_mXgENnYjWQA.png

D80aoGRgRzaOI37UxKTkGQ.png
  • Demo site updated (with threaded config)
All updates have been pushed to
 
Last edited:

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
Committed changes (Dec, 31, 2017)
  • Adding options for which mimetypes to compress
  • Moved handlers to their own middleware (see )
  • Tidying up routes (see )
  • Tidying up controllers (see )
  • 404 page complete (see )
  • Started admin panel (see ) (theme: )
  • Updated README.md with Gunicorn docs for fastest possible setup.
( is running trinity now. Testing compression speeds for gif banners, feel free to check it out.)
R7WuP6tHSB_lVT3vWkrmNg.png

__admin__login.py
jHwnY-y2R4aU3b28jGPxGQ.png
 
Last edited:

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
Great to see this being picked up again. Surely one of the most promising things we've had here.
You tha man. I love following this progression. Can't wait for more updates.

Cheers guys thank you so much.

Any suggestions on a simple barebone lightweight admin panel theme? Currently using as a base, has to be mobile friendly.
I want to avoid themes that rely on view/js libraries, something simple with maybe 3 css & >3 js requests max. I chose the theme above because it just uses jquery and bootstrap.

I might just stick with the theme above though, it's really light and serves as a good starting point for what i need. i can do all the styling myself.
 

Committed changes (Jan, 1, 2018)
  • Started html editor (see )
  • Integrated html editor into admin dashboard for testing (see )
  • Completed admin login controller (see )
  • Started admin login model (complete but exploit free) (see )
E_bbTklYTfWgZw36ZLnwlw.png

oa3xMTcnQCS_EVywLQlXqQ.png


*final brainstorm* probably gonna go with config on left, html editor trigger on right
MuzZcR47RVicET0P6-ru0g.png
will be using this for client side:
zeCSGmCcREiEwYHzgs7T5A.png

gnK0lyrqR-_Nsc-n5MeLxA.png
 

Progress (Not committed yet, Jan 2 2018)
  • Tidying up general admin theme look (compare images below to )
  • De-uglified the gigantic title bars, lmao.
  • Finished general stats, config overview.
  • More html editor progress
  • Integrated ace editor
  • Started research on json vs ujson for local storage ( )
r6GhQyVkQ7OkKNGWducspA.png


nqjSmXRkSeaQAXVGIM4u-Q.png
 

Progress (Not committed yet, Jan 2 2018)
After a bunch of headaches trying to get to stay responsive, i resorted to using a javascript resize script i found on the web:
It's alot more sane to work with, you can just adjust the editor based on your own preference since i cba fixing it for every screen. is stubborn as shit.
-MN-_eHZQNKlkJVUqPC0rQ.png

The border color will change eventually obviously, i'm just glad i have it working now.

The python code has been waiting for me to come back to it for awhile, ace is what was taking all of my time recently.
9NL2fRJST4WuIBlfgh9fuw.png


xqlnms_pTAaZaocRZhTGAw.png





Fininished a good ammount of work on the dashboard:
teToyalFTQOM9AuVn-xi5w.png

KoZpByhuTUSjXZzdItVwZQ.png
 
Everything in this past thread has
Also, live demo updated to current repo try tampering with the login :p
  • html editor class is now a general "contentmanagement" class (see )
  • Added "contentmanager" controller (see )
  • Added "contentmanager" handle to handlers (see )
  • Renamed database.py to mysql.py in hope for future mongodb integration (See )
  • Ace editor fully integrated (biggest pain in the ass ever) (see )
  • Login model added (see )
  • Dashboard progression, content count and config settings (see )
  • Added mysqldb.sql with `users` table and default user included. (tr4-admin : password)
  • Confirmed to be working cross platform. (tested on redhat & win10)
 
Last edited:

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Cheers guys thank you so much.

Any suggestions on a simple barebone lightweight admin panel theme? Currently using as a base, has to be mobile friendly.
I want to avoid themes that rely on view/js libraries, something simple with maybe 3 css & >3 js requests max. I chose the theme above because it just uses jquery and bootstrap.

I might just stick with the theme above though, it's really light and serves as a good starting point for what i need. i can do all the styling myself.

If you really want something lightweight, get a React.js theme and not jQuery. jQuery is much more intense and takes more time rendering due to all the work done in the DOM. React.js is, as far as I remember from tests, almost two times as fast as jQuery based themes.
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
If you really want something lightweight, get a React.js theme and not jQuery. jQuery is much more intense and takes more time rendering due to all the work done in the DOM. React.js is, as far as I remember from tests, almost two times as fast as jQuery based themes.
@griimnak drop me a PM I got a React template you can use.
The codebase is not exactly clean or up to date, but for your purpose it's fine and there follows a documentation which explains all the components and elements available etc.


Thing is React will be handling all routing so you don't have to do it through Python, but all you gotta do is point every entrance ('/admin/*') to a index.html file requiring the initial bundled React file.
 
Last edited:

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
If you really want something lightweight, get a React.js theme and not jQuery. jQuery is much more intense and takes more time rendering due to all the work done in the DOM. React.js is, as far as I remember from tests, almost two times as fast as jQuery based themes.
@griimnak drop me a PM I got a React template you can use.
The codebase is not exactly clean or up to date, but for your purpose it's fine and there follows a documentation which explains all the components and elements available etc.


Thing is React will be handling all routing so you don't have to do it through Python, but all you gotta do is point every entrance ('/admin/*') to a index.html file requiring the initial bundled React file.
Thank you for the info, I'm really outdated on frontend, i was still tkinking jquery is the go-to lol.
I'll be looking at Marcus's react theme for possible integration, flask might not play nicely with react, but i presume it should..
 

Genial

Backend Developer
Jul 29, 2017
19
14
Like how the project is coming along. You should look into adding . It provides modern cypto api.
 

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
Like how the project is coming along. You should look into adding . It provides modern cypto api.
Is it better than ?
 

Genial

Backend Developer
Jul 29, 2017
19
14
Is it better than ?
You can use them both, sodium acts as a wrapper. If you prefer one i would go with sodium as sodium is a modern cryptography library that offers authenticated encryption, high-speed elliptic curve cryptography, and much more. Unlike other cryptography standards (which are a potluck of cryptography primitives; i.e. WebCrypto), sodium is comprised of carefully selected algorithms implemented by security experts to avoid side-channel vulnerabilities.
 
Last edited:

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
Committed changes (Jan, 4, 2018)
Big performance improvements. (benchmarks below)

  • Improved config reader (see )
Before and after:
iAxqpTlfSJW8VtN11nNzVg.png

  • Improved mysql performance (~30%) (see )
  • Implemented persistent mysql connection instead of per request.
Before and after:
7fZxzTVKQXmMLIoNZK07HQ.png

  • Improved controllers and models to fit their roles more accurately (see )
Before and after:
Controllers:
uoTmxokdRg_vOeAJSn-y0Q.png



Models:
uPixb-OxQW28C3JJweL95w.png

Benchmarks:
MySQL per request vs persistent
pubchart


Load times after commit compared to old source:
BEFORE:
raGLmIbOS76Nhw2gH8eaIw.png

gWpTRxQmSaydZVFmSTj43g.png

AFTER:
mt8w1SBtS-qshr2iX8taYg.png

bi8anSASRImvQp-qU-pqIg.png

Removing frontend js libraries
And I think I mad my mind on the admin template. I'm not gonna use jquery or react, i'm gonna go vanilla js :D
Flask actually plays really well with react, it'd be a wicked idea but not suitable for what i want to achieve, it's too many libraries and kinda goes against the philosophy of trinity.
(sources: )

Why?
Because it's too much libraries. I don't want to require my user to have to install npm yarn etc. Even jQuery is gonna go, we're going vanilla in this bih.

f0lHRCaXT4yHqcn4U0XyQw.png

 
Started new admin design. Inspired by , completely scratch vanilla js no libraries.
Fully responsive thanks to css3 flex

G101xySGRwiE7FQQDvxGFA.png


n5Iut8EJRs_UR54rL9auvw.png


xtPJWLYzSdGkuPjoRIN2jw.png

ZlvGtz_uRImjpQbvYuzJEw.png
 
Last edited:

LeChris

John 15:18
Sep 30, 2013
2,786
1,395
Committed changes (Jan, 4, 2018)
Big performance improvements. (benchmarks below)

  • Improved config reader (see )
Before and after:
iAxqpTlfSJW8VtN11nNzVg.png

  • Improved mysql performance (~30%) (see )
  • Implemented persistent mysql connection instead of per request.
Before and after:
7fZxzTVKQXmMLIoNZK07HQ.png

  • Improved controllers and models to fit their roles more accurately (see )
Before and after:
Controllers:
uoTmxokdRg_vOeAJSn-y0Q.png



Models:
uPixb-OxQW28C3JJweL95w.png

Benchmarks:
MySQL per request vs persistent
pubchart


Load times after commit compared to old source:
BEFORE:
raGLmIbOS76Nhw2gH8eaIw.png

gWpTRxQmSaydZVFmSTj43g.png

AFTER:
mt8w1SBtS-qshr2iX8taYg.png

bi8anSASRImvQp-qU-pqIg.png

Removing frontend js libraries
And I think I mad my mind on the admin template. I'm not gonna use jquery or react, i'm gonna go vanilla js :D
Flask actually plays really well with react, it'd be a wicked idea but not suitable for what i want to achieve, it's too many libraries and kinda goes against the philosophy of trinity.
(sources: )

Why?
Because it's too much libraries. I don't want to require my user to have to install npm yarn etc. Even jQuery is gonna go, we're going vanilla in this bih.

f0lHRCaXT4yHqcn4U0XyQw.png

 
Started new admin design. Inspired by , completely scratch vanilla js no libraries.
Fully responsive thanks to css3 flex

G101xySGRwiE7FQQDvxGFA.png


n5Iut8EJRs_UR54rL9auvw.png


xtPJWLYzSdGkuPjoRIN2jw.png

ZlvGtz_uRImjpQbvYuzJEw.png
Damn, you have a whole 4 n1ggers

OT Good job man, didn’t realize you were still developing this project.
 

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800

Threw up a youtube video of the admin theme's current state, i'm actually somewhat proud.
Looking rather clean if I was to say so myself :p

here's a look at the vanilla js behind it:
W3fVtlAmQBOq0V9mx2ixxg.png

console.log is only debugging purpose, it'll be removed later on.
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683

Threw up a youtube video of the admin theme's current state, i'm actually somewhat proud.
Looking rather clean if I was to say so myself :p

here's a look at the vanilla js behind it:
W3fVtlAmQBOq0V9mx2ixxg.png

console.log is only debugging purpose, it'll be removed later on.
You could write the JS like you would do in React, first render, actions for http server requests (ajax), components if you're handling CSS, events and so on, and maybe a way to wrap them all into having the user object etc like dependency injection.
Could make the coding structure look way more neat, since I assume you're gonna have a lot vanilla JS.

Then you could use a bundler like Webpack to have ES6.

Just a thought :p
If you want I could help you out
 
Last edited:

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
You could write the JS like you would do in React, first render, actions for http server requests (ajax), components if you're handling CSS, events and so on, and maybe a way to wrap them all into having the user object etc like dependency injection.
Could make the coding structure look way more neat, since I assume you're gonna have a lot vanilla JS.

Then you could use a bundler like Webpack to have ES6.

Just a thought :p
If you want I could help you out
to use react you have to do routing on the client though don't you? i wanna keep the routing in flask, basically only using javascript for dom manipulation
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
to use react you have to do routing on the client though don't you? i wanna keep the routing in flask, basically only using javascript for dom manipulation
I'm not talking about routing. Just how the coding structure is in React / Redux and OOP in general e.g like many does it in PHP
 
Status
Not open for further replies.

Users who are viewing this thread

Top