Python and Blocs

Python seems to be getting much attention. I recently had a meeting with an expert in that field. He strongly believes Python is the future of coding. If that is the case, will there be any known issues with Blocs 3?

Python is more about backend programming rather than front-end coding in the browser. It’s possible that may change, but I don’t see javascript going away anytime soon.

Python & Django are often replacements for PHP in dynamically generated pages. I used to use Java Server Pages - there are loads of technologies out there for the web server coding for dynamic pages, Python is very popular right now, particularly with library support for AI and data analysis.

I’m sure Norm will chime in but I don’t see Python as relevant for Blocs 3. Javascript is king on the front-end.

I am currently using blocs with python django framework.

I still have some issues, particularly for managing static files but It works

Jerome are you using blocs designs as a template for use with python on the backend (as per PHP or JSP)?

Nope,
Only front so far.

I don’t know what is your purpose here but I can tell you this.

Frontend and Backend is totally different things. JavaScript is the only language that has the capability to work on both sides.

If you are looking for data analysis and machine learning coding then you should use Python and R because these are the first choice for all the developers. Jupyter notebook is the best tool here and Visual Studio Code is the best editor out there.

I hope this helps,

Best regards,

1 Like

Python is indeed a generally solid language. Used it in prior work to build chunks of enterprise apps at scale (it’s not just a scripting language as some seem to think :wink: ), as well as doing some Pylons/Pyramid (like django) some time ago - which is a web MVC framework.

As others stated, python isn’t inherently a web front end language, but can be used to replace PHP to an extent for backend code, calls into DBs, or pretty much anything else not directly web UI. Frameworks like Django, Turbogears, Pyramid/Pylons etc. let you basically templatize a LAMP/WAMP app in a reasonably sane fashion using a MVC (Model / view / controller) model model, stubbing out schema and site routing etc. Basically - pretty much overkill for most small static type sites, but becomes useful when considering something more DB or backend driven.

Not sure what problem you’re trying to solve here, but I also highly recommend Python as a first programming language, as it’s less clunky than Java to get going on, less complicated in obscure ways than C++, more readable than both, and can be leveraged almost immediately for scripting of simple things and growing into more complex apps, object oriented, … - as well as someone mentioned, used heavily in machine learning along with Ruby.

Hi Pauland,
now i use Blocs with Django as templates indeed.
I rewrite a bit the HTML & CSS in a proper Django way, mostly for links (avoid hard coding) & static assets {% static %}.
It works pretty well.
You can also directly integrate CSS classes in your template as a ‘context’ in your def or class.

Finally, check your CSS for your background images & rewrite these in ‘static’ links as well & all will run smoothly. )

This is an interesting article

Hey @KBConcepts and @Jerome,

Thanks for discussing this topic.

Right now I’m using Blocs for front end development only, historically leveraging Wordpress/PHP. However one of my developers has recommended we investigate using Django as the web framework for some of our future projects.

As a complete ‘foreigner’ to Python and Django, if you were building a basic “blog” app using Django and Blocs, what approach are you taking to designing, structuring and maintaining a Django app while using Blocs for templating/designing the front end?

@Jerome from my searches on the forum, I note you are a big proponent of using Django with Blocs, so I’m quite keen to get an understanding from a “complete newbies” point of view, how you make that work and what the ideal set up looks like.

Any help/guidance is greatly appreciated.

Thanks!

It depends of your workflow, i speak about my experience, you can either:

Build all your front website with Blocs app, then export it. You get your html pages on one part & your img, css, js on the other part. So you have to learn how to handle static files & html templates in Django, afterwards it’s relatively easy to integrate. Maybe tedious first times because you have to rewrite a bit in the html).

Or you can build the front step by step. Your header & footer for exemple that you put in your base.html then perhaps a card as a model for all your cards since you also don’t need to repeat in Django, you iterate & loop inside the html templates.

What’s also cool is that you can add Bootstrap classes here & there to fit some details.

If you’re brand new in Python/Django, start by a Python crashcourse, otherwise you’ll be lost if you have no ideas about objects, functions, classes and so on.

then adopt Django by learning the architecture (Models-Views Templates).
The learning curve is not that tough, there’s a huge community ready to help, & tons of docs… with time you’ll realize how the benefits overpassed all what you can expect :slight_smile:

1 Like