#1  
Old 12-15-2019, 09:33 AM
fragment's Avatar
fragment fragment is offline
mesospheric bore
 
Join Date: Jul 2005
Location: New Zealand
Gender: Male
Posts: VDCXXVII
Blog Entries: 8
Images: 142
Default Web frameworks

It's been a dozen years since I was a web developer, but am likely to be doing a little in the near future. I was mainly using PHP but there seem to be better options these days. HTML/CSS/Javascript has a lot of new stuff to consider. And there seem to be good frameworks, although I'm not really convinced by MVC. I get the impression Rails is on the way out. Thinking of looking at Django.

Pros:
Impetus to learn Python

Cons:
Have to learn Python

Any suggestions, thoughts or advice?
Reply With Quote
  #2  
Old 12-15-2019, 02:34 PM
JoeP's Avatar
JoeP JoeP is online now
YELLOW HAIR FAKE ANIMAL
&
FLOOFIN CHONKO
 
Join Date: Jul 2004
Location: England/Miisaland
Gender: Male
Posts: XXVMMDCXXX
Images: 18
Default Re: Web frameworks

I have done a bunch of stuff in Django, though one of my main motivations was already knowing Python and wanting to use it.

Django is good, but having run up against the somewhat arbitrary decisions in some of the more advanced elements I am considering Flask for the next thing I do. Although I'm not completely decided on this - Django has evolved to make most or all of the advanced elements optional and replaceable by plugin alternatives, which do exist. And while Flask is newer and has in principle a better structure (i hear) it doesn't do as much for you out of the box (I hear).

(So to summarise: my recommendation is look at Django and Flask. I have no other web frameworks to recommend. Run away from PHP. No opinion on Rails.)
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:       :eur:       :m&ms::m&ms::twix::twix: (rotated 180°):m&ms::m&ms:
Reply With Quote
Thanks, from:
fragment (12-15-2019)
  #3  
Old 12-15-2019, 02:35 PM
JoeP's Avatar
JoeP JoeP is online now
YELLOW HAIR FAKE ANIMAL
&
FLOOFIN CHONKO
 
Join Date: Jul 2004
Location: England/Miisaland
Gender: Male
Posts: XXVMMDCXXX
Images: 18
Default Re: Web frameworks

You should learn Python anyway. Not a con :wink:
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:       :eur:       :m&ms::m&ms::twix::twix: (rotated 180°):m&ms::m&ms:
Reply With Quote
Thanks, from:
fragment (12-15-2019)
  #4  
Old 12-15-2019, 02:45 PM
JoeP's Avatar
JoeP JoeP is online now
YELLOW HAIR FAKE ANIMAL
&
FLOOFIN CHONKO
 
Join Date: Jul 2004
Location: England/Miisaland
Gender: Male
Posts: XXVMMDCXXX
Images: 18
Default Re: Web frameworks

A key factor is whether you need a database. If you do, you should look at an ORM, and Django is good there. Although annoyingly different from SqlAlchemy which I was more familiar with.
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:       :eur:       :m&ms::m&ms::twix::twix: (rotated 180°):m&ms::m&ms:
Reply With Quote
Thanks, from:
fragment (12-15-2019)
  #5  
Old 12-16-2019, 12:12 AM
fragment's Avatar
fragment fragment is offline
mesospheric bore
 
Join Date: Jul 2005
Location: New Zealand
Gender: Male
Posts: VDCXXVII
Blog Entries: 8
Images: 142
Default Re: Web frameworks

Quote:
Originally Posted by JoeP View Post
You should learn Python anyway. Not a con :wink:
Meh, I get enough of having whitespace dictate my code formatting with R.

Quote:
Originally Posted by JoeP View Post
A key factor is whether you need a database. If you do, you should look at an ORM, and Django is good there. Although annoyingly different from SqlAlchemy which I was more familiar with.
Almost certainly will want databases. ORM look interesting, although having read a bit about functional programming recently I'm going a bit away from OO. I am also NoSQL-curious. Ultimately I prefer relatively painless switching between data sources. If I decide to change from reading a flat file to a SPARQL query that should require few changes that are all in one place.

I guess I need to think more about requirements. My only definite upcoming project is almost certainly going to be a Wordpress/Woocommerce implementation, so hopefully little tinkering with the main code.

Beyond that I have 2-3 half-formed web application ideas that have been knocking around my head for a while. Probably the most important thing is good libraries for common tasks. I shouldn't be building an authentication system, for example, as it's likely to be more annoying and less secure than what is already available in the framework.

Can you point me to any good Django resources? Particularly curious about how MVT looks in practice.
Reply With Quote
Thanks, from:
JoeP (12-16-2019)
  #6  
Old 12-16-2019, 04:40 PM
JoeP's Avatar
JoeP JoeP is online now
YELLOW HAIR FAKE ANIMAL
&
FLOOFIN CHONKO
 
Join Date: Jul 2004
Location: England/Miisaland
Gender: Male
Posts: XXVMMDCXXX
Images: 18
Default Re: Web frameworks

The whitespace thing really isn't an issue after a short time with it. The only thing that bites me is not being able to have empty blocks, and the existence of the pass statement as a workaround.
Code:
def new_function():
    # TODO
IndentationError: expected an indented block

def new_function():
    pass

def new_function():
    "docstring"
The O and R parts of ORM aren't necessarily mandatory - it's really about runtime in-memory data structures to persistent storage structures mapping, except "RIMDSTPSSM" never caught on. If you don't have any object inheritance or composition to map, you ignore those parts of the ORM and the relational stuff they map to. That said, each ORM-like approach will bring some limitations - while doing a lot more out of the box than you could implement yourself.

One thing Django is good at is authentication. It has a lot of stuff to get you started quickly ... and after a while, you may find you want to replace some of its approaches, but at least you can do that, module by module.

Some would say, for a real web app, don't even think of flat files. Assume the database will be provisioned by someone, and will run on multiple servers separate from your app. Also assume you don't have any persistent local storage outside a managed database and whatever can be configured via a hosting admin interface. Obviously not in initial iterations - but it helps to plan for it. Understand The Twelve-Factor App and at least know when you are not ready to follow each principle.
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:       :eur:       :m&ms::m&ms::twix::twix: (rotated 180°):m&ms::m&ms:
Reply With Quote
Thanks, from:
fragment (12-16-2019)
  #7  
Old 12-16-2019, 04:53 PM
JoeP's Avatar
JoeP JoeP is online now
YELLOW HAIR FAKE ANIMAL
&
FLOOFIN CHONKO
 
Join Date: Jul 2004
Location: England/Miisaland
Gender: Male
Posts: XXVMMDCXXX
Images: 18
Default Re: Web frameworks

As for tutorials, the ones I have notes of and think were good include:

Introduction Django Girls Tutorial - I basically did this one and then just used the official documentation, which is pretty good
Django Web Framework (Python) - Learn web development | MDN
and even the official one Getting started | Django documentation | Django

Not a tutorial as such but I think you might get a lot from this: Django’s Structure – A Heretic’s Eye View - Python Django
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:       :eur:       :m&ms::m&ms::twix::twix: (rotated 180°):m&ms::m&ms:
Reply With Quote
Thanks, from:
fragment (12-16-2019)
  #8  
Old 12-16-2019, 10:33 PM
fragment's Avatar
fragment fragment is offline
mesospheric bore
 
Join Date: Jul 2005
Location: New Zealand
Gender: Male
Posts: VDCXXVII
Blog Entries: 8
Images: 142
Default Re: Web frameworks

Quote:
Originally Posted by JoeP View Post
don't even think of flat files
Bit of a joke example, although I do sometimes use them in development.
Reply With Quote
Thanks, from:
JoeP (12-17-2019)
  #9  
Old 12-17-2019, 12:20 AM
JoeP's Avatar
JoeP JoeP is online now
YELLOW HAIR FAKE ANIMAL
&
FLOOFIN CHONKO
 
Join Date: Jul 2004
Location: England/Miisaland
Gender: Male
Posts: XXVMMDCXXX
Images: 18
Default Re: Web frameworks

Quote:
Originally Posted by fragment View Post
Quote:
Originally Posted by JoeP View Post
don't even think of flat files
Bit of a joke example, although I do sometimes use them in development.
Of course. Likewise. And my development hacks never make it into production :shiftier:
__________________

:roadrun:
Free thought! Please take one!

:unitedkingdom:   :southafrica:   :unitedkingdom::finland:       :eur:       :m&ms::m&ms::twix::twix: (rotated 180°):m&ms::m&ms:
Reply With Quote
Thanks, from:
fragment (12-17-2019)
Reply

  Freethought Forum > The Marketplace > Computers & Technology


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

 

All times are GMT +1. The time now is 05:54 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Page generated in 0.25862 seconds with 13 queries