Web app development - a couple of questions (Python, Flask, ??)

rusvik

New member
Jan 21, 2011
2,405
29
0
I've been doing a bit of coding and learning in Python with the goal of both creating tools for myself and eventually turning those tools into web apps for others. Where I'm at is that I have decent grasp of Python and have made a couple of scripts that actually save me time, mostly scraping related and SEO. What I'm struggling a bit with is the MVC part and webdesign.

It would be very awesome if you could help me with these:

1) Database design

What is a good tutorial on database design. Not the SQL part or ORM syntax and such, but how to design a database hierachy properly with users and their relations with data and so on. An online course of some sort would be great, like you'd learn in a comp-sci class.

2) Which stack for web app?

There seems to be a lot of options here, Flask, Django, Node.js, Bootstrap etc. I'm having a hard time deciding on which to pursue and how they go together. There are also significantly less books and tutorials on this part?

3) HTML/CSS and Jquery

What is the value of actually spending time on learning webdesign? I'm not a natural visual designer and struggle with css. My attempts look ugly basically. Is it relatively easy to get someone to polish up a site with the architecture made in 2) or are front-end designers not used to working with those?

4) Scripts, membership site or executable

A bit further down the road, if you make an app in Python for example, how difficult is it to sell as a script? Is it even possible mass market, since setting it up isn't as easy as PHP? What if your app needs confidential usr data like logins? If you want to make it a windows exe, would it be better just to learn Java? I realize these questions are noobish.

Much appreciate feedback.
 


AngularJS is looking good for web apps.

I've been diving into AngularJS for awhile. First on Apache but then going full into a MEAN stack and a lot of it feels too good to be true. My concern is that there will be some sort of injection danger exposed in the future but it looks pretty tight.

If you haven't checked it out, might want to take a look. There's a lot of good tutorials and presentations on YouTube like...

[ame="http://www.youtube.com/watch?v=TRrL5j3MIvo"]Introduction to Angular.js in 50 Examples (part 1) - YouTube[/ame]


Start with trying it in plain HTML first before diving into node.JS if you are kind of new to node.
 
1) Database design

Database design itself is a hard topic as its very specific to each application. That being said, most databases are relatively simple. Just think about how you split things up in to logical sections. Your best bet to figure this out, as even I am having trouble finding any good tutorials, is to look at others work. A good example would be like how does blogging software work? If you understand all the SQL stuff behind it, once you start to figure it out it should just click.

Lets say I have a blog, what do I need? I need a table for the users, I need a table for the posts, and I need a table for the tags. From there you just break the data down in to smaller parts. Ok a post has a title, a body, a creation date, etc... The rest is really just setting up proper relations, indexes and whatnot and writing the queries.

2) Which stack for web app?

Well there is no real right or wrong answer here. Lots of this is your own personal preference which is why you wont see books about it. There are many tools, pick the ones you want to work with and use them. This is something that comes more with experience than anything. I personally went from PHP to Python to Go for server side stuff. I went from using jQuery on the presentation side to just doing the entire presentation layer in AngularJS. I went from using Apache to Nginx as web servers. I went from MySQL to MongoDB to MariaDB to Postgres. If you are looking for simple answers, there are none. There are in my mind "better" solutions, but things can be done in a number of ways and really comes down to what you are trying to accomplish. Honestly the only way you can make such decisions is to jump in and start doing, then look at your process and see how you can make it better if you are even inclined to do so. I've been doing web development professionally for like 4 years now and I've reworked my processes completely many times in the past and totally in the last several months. I am positive it wont be the last time.

My current web app workflow:
  • AngularJS (presentation layer)
  • Go (server side RESTful server)
  • Less or Sass (easy way to separate css without going nuts)
  • Yeoman (automate and build your project, compile Less/Sass, easy way to add views and whatnot, easy way to serve your project on your dev machine)
  • Grunt (more project automation, Yeoman uses it as well)
  • Bower (easy web package management)
  • PostgreSQL

3) HTML/CSS and Jquery

You don't really need to know design to make web apps these days. By that I mean you don't need to know like how to open up photoshop and do a design from scratch. There are web frameworks like Bootstrap out there that allow pretty much any idiot to make something that doesn't totally look like shit. Many of the graphics people these days are familiar with things like Bootstrap and can usually convert your template you had them design to the framework. Many templates like the ones on Theme Forest are already done with Bootstrap so that you can customize the site to your spec.

What you really need to know is how to manipulate the css though, so you will need some kind of css background or you'll have to outsource it.

4) Scripts, membership site or executable

This is very broad. The question is to look at your target market I guess. Even though it's relatively easy to setup PHP apps because many web hosts are already setup for them, for example if they have cPanel installed, it is still not uncommon for people to hire someone to install it for them. It's typically still not dummy proof enough. Frankly I wouldn't really let that play in to your decision as to wether or not to do a script in Python or whatnot. Python apps aren't really any harder to deploy than PHP apps. Go apps are even easier than both IMHO.

As for Java, it has a very wide range. You can do desktop stuff, you can do web stuff. Where Java typically suffers is it's not a very easy language, in fact it's kind of a cluster fuck which is why you see the rise of Scala in an attempt to tame Java (my brother actually is a Scala dev). It is actually a really fast language though and not the worse choice ever, lots of resources to learn from as its a popular language.

So at the end the advice I have to you is to jump in, get dirty, break things, make mistakes and start figuring out what works for you. We didn't even touch on shit like OOP vs functional or what kind of tools like IDEs. There are no easy answers, and if you ask 10 developers you'll likely get 10 different answers.
 
For database structure, I'm assuming you already know the basics? One-to-one, one-to-many, and that sort of shit? If so, then I think it's just a matter of experience and having a technical mind. You need to be able to map this shit out in your head though, or maybe grab a pen & paper and sketch it out. If anything, download some well known systems like phpBB, SugarCRM, Wordpress, Piwik, etc... and take a look at their database schemas. I think they all have install SQL files with them, so look through them.

Although others recommended against it, I would highly recommend learning SQL, and pushing yourself to learn it vastly. It's FAR more powerful than most "developers" realize, and can make your job much easier. For example, I just finished a project where I had to clean up a system that was written by someone else. I was literally able to remove 65%+ of the code while retaining all functionality, and this included tons of 20+ line PHP functions that can be done with a simple SQL query.

As for functional vs. OOP, as Rage9 said everyone will have a different answer, but I'd say always err on the side of OOP. It's just common sense organization, really, If you have 8 functions that deal with e-mail notifications, then throw them into a class. Then go through that class, and there's a good chance you'll be able to remove 30%+ of the code in those 8 functions. Nice and clean, plus makes it easier for other developers to dig through your work if / when needed. For example, a standard app I'd make would maybe have 10 procedural functions, and 150+ OOP functions.

Yes, you should know HTML / CSS / Javascript, and least to an intermediate level. You don't need to be an expert, but need to able to take any zip file off ThemeForest, and implement that theme into your web app.

As for your last question, it's too broad to answer. It's like asking, "how do you sell food?" type of thing. There's simply too many possibilities.
 
A) For noobs, I'd recommend a simple REST server microframework.

- For Python, there's Flask
- For Ruby, there's Sinatra
- For Node.js, there's Express
- etc., every language has one

They all basically work something like this:

o2x20_bi.png


When you run it on your computer, it'll be accessible at `http://localhost:3000`.

- Navigating to "http://localhost:3000/" (homepage) will respond with <h1>Hello World</h1>
- Navigating to "http://localhost:3000/foobar" will respond with <p>You said: foobar</p>

It's a good place to start since you can build up incrementally from there.

B) When you want to add a database, I recommend starting with Mongo since it's much easier to get something up and running. You can install Mongo on your computer and connect to it. But if you use the free plan at https://www.compose.io/pricing/, your app will Just Work when you deploy it.

C) Once you get a basic app working, deploy it to Heroku. It'll be a great, encouraging feedback loop to see your app (no matter how trivial/noobish) live on the internet at mynoobapp.herokuapp.com. That's the goal of my post.

- I wouldn't worry about the design of your app at this point. And I wouldn't worry about it until you complete step C. It's just counterproductive to attack too many concepts at once. But when you're ready, I recommend Twitter Bootstrap. If you click here, Getting started · Bootstrap, you can see the CSS link that you can just drop into your html.
- It's probably best to avoid AngularJS and other Javascript front-end frameworks until you're comfortable with these steps. You can build big applications like a forum or a Reddit clone without a line of Javascript, so I think introducing Javascript too early just complicates your learning process.

I think a lot of us take it for granted since we've been doing it for so long, but I reckon the hard part about entering web dev as a noob is that it seems like this big amorphous blob of concepts. MyMongoResponsiveHTML6NodestrapularJSful. So I tried to provide a roadmap with a simple progression.