How to make a pretty Python web app? - python

I'm looking for a python web framework that is easy to use and allows me to generate some nice looking user interfaces on the fly. I have not much experience with web development and don't want to spent much time to learn internals.
So far I use cherrypy and mako templating to serve the app. My problem is, it just looks awful. I'd like to have some nice (maybe AJAX?) features available to make the app a little bit more fancy.
My app is a simple search site without any database connection. So I have a main page where the user enters the search string and a result page. In the end it should look like the Goole search, with some hover effects for the results, nice keyboard controls, maybe even something similar like the page preview from Google.
So to achieve this, should I use a different framework or do I need to write the CSS and javascript by hand? What options do I have?
Thanks!

Your user interface has nothing to do with the web framework you choose to use.
That said, you might find Bootstrap useful:
Bootstrap is a toolkit from Twitter designed to kickstart development
of webapps and sites. It includes base CSS and HTML for typography,
forms, buttons, tables, grids, navigation, and more.
You might also find this article useful: http://web.archive.org/web/20120418061148/http://jamie-davidson.com/2012/01/resources-to-hack-design/ (original article at: http://jamie-davidson.com/2012/01/resources-to-hack-design/ is no longer available)

"easy to use"
Django
"generate some nice looking user interfaces on the fly"
Django!
"don't want to spent much time"
Django!!
For javascript, I strongly suggest jQuery and for some CSS: Grid 960.

How about Django or Pinax? Maybe BlueBream? There are so many Python frameworks... If you're new to dev work, however, choose one in which there's a solid offline local community to lean on...to go to with questions to help get the app built. (In L.A., it's Django.) But, specifically to your app, my question would be: if you only have essentially just two different page layouts--i.e., the main search page where a user inputs their query, and then X number of dynamically generated pages for the results...and no database--do you really need a whole Python "framework" for that? You write that you're also looking to dynamically generate "nice looking user interfaces on the fly"...which is a little confusing given the stated scope of your app.

Pyjamas - Python Javascript Compiler, Desktop Widget Set and RIA Web Framework

I found interesting web2py framework, easy to install, and it has o lot of features as "from the box"

Related

Design Decision Django Rest Framework - Django as Frontend

I am currently developing my first more complex Web Application and want to ask for directions from more experienced Developers.
First I want to explain the most important requirements.
I want to develop a Web App (no mobile apps or desktop apps) and want to use as much django as possible. Because I am comfortable with the ecosystem right now and don't have that much time to learn something new that is too complex. I am inexperienced in the Javascript World, but I am able to do a little bit of jQuery.
The idea is to have one database and many different Frontends that are branded differently and have different users and administrators. So my current approach is to develop a Backend with Django and use Django Rest Framework to give the specific data to the Frontends via REST. Because I have not that much time to learn a Frontend-Framework I wanted to use another Django instance to use as a Frontend, as I really like the Django Template language. This would mean one Django instance one Frontend, where there would be mainly TemplateViews. The Frontends will be served on different subdomains, while the backend exposes the API Endpoints on the top level domain.
It is not necessary to have a Single Page App. A Normal Website with mainly the normal request/response-cycle is fine.
Do you think this is a possible approach to do things? I am currently thinking about how to use the data in the frontend sites in the best way. As I am familiar with the Django template language I thought about writing a middleware that asks about the user details in every request cycle from the backend. The thought is to use a request.user as normally as possible while getting the data from the backend.
Or is ist better to ask these details via jQuery and Ajax Calls and don't use the django template language very much?
Maybe there is also a way to make different Frontends for the same database without using REST?
Or what would you think about using a database with each frontend, which changes everytime I make a change in the main database in the backend? Although I don't really like this approach due to the possibility of differences in data if I make a mistake.
Hopefully this is not to confusing for you. If there are questions I will answer them happily. Maybe I am also totally on the wrong track. Please don't hesitate to point that out, too.
I thank you very much in advance for your guiding and wish you a nice day.
as per my experience and knowledge, you are almost going towards correct direction.
my recommendation is for making backend rest api Django and django rest framework is the best option however for consuming those api you can look for the angular or react both works very well in terms of consuming API.
Thank you for your input om tripathi.
I think it really does make sense to use the modern js frameworks for consuming a REST API.
I looked a little further into my problem and found multitenancy to fit my requirements perfectly. There are also great plugins and good reads for that use case. Just for others some informations I stumbled upon:
https://djangopackages.org/grids/g/multi-tenancy/
https://www.vinta.com.br/blog/2017/multitenancy-juggling-customer-data-django/
Especially the second link gave me information about different design approaches. For myself I chose to go the way with one database for every Client and then using the site framework from django to seperate data. For the Subdomain resolving I use django-hosts.
Thank you again and have a nice day.

What Are The Advantages of Building a Web-Page with Django as Opposed to Solely Using HTML5/CSS3?

Essentially, my questions are as stated above in the title. What I'm really seeking to know is why it would be privy of me to build a web-page utilizing the Django framework as opposed to solely building it out with HTML5 and CSS3.
I do know that Django utilizes bootstrapping of HTML5 and CSS and this is where my questions are raised over the efficiency of using the Django framework as opposed to solely using HTML5/CSS3.
1.) What are the advantages of Django?
2.) What does utilizing the Django framework offer me that HTML5/CSS3 do not?
3.) HTML5 can also build dynamic web-pages as can Django. Why would Django be better for a dynamic web-page?
I am looking for a very valid answer here as I am about to start building my web-page. The responses I get to these questions will be the nail in the coffin for which method I will be using to build the web-page. Thanks ladies and gentleman and I hope you find this question to be worth your while in answering.
Django is a server side framework. So it has little to do with HTML.
Django will give you easier/standardized ways to handle HTTP requests, and to manipulate entries in the database, among other things.
HTML5 alone doesn't enable dynamic web-pages. You can have interactive web pages, but they will always be the same, for every user, whenever you access it.
Django is a python web application framework that allows you to send requests from your page to a server that will in turn provide a response back to your web page.
Advantages: The power of Django is the ability to quickly get both the client ( your page ) and the backend ( the server-side logic ) setup. The backend can include writing to a database, processing information, retrieving information which is subsequently a response delivered to your web page.
HTML5/CSS3 is markup languages for your web page. You can use a editors like sublime or even notepad ++ if you are building a static web page. Django, like most web app frameworks, are used because of what I've described in #1 ( and many other unlisted reasons ).
HTML5 provides the ability to make dynamic web pages ( using a client side library like JQuery as an embedded script ), Django helps you build web apps. You can write a web page using only HTML5 and JQuery to display list of tv shows that are currently on ABC by listing what is currently playing today, but what about for tomorrow? You need server-side help by creating response that will fetch all shows for tomorrow by calling the ABC API. Take a look at server-side logic and web applications.
In short, there are web pages and web applications. Sounds like to me you are building the former, so Django might be overkill.
1.) What are the advantages of Django?
Server-side scripting without the necessity to use PHP. If you already worked with Python, you don't need to learn another language for you server-side.
2.) What does utilizing the Django framework offer me that HTML5/CSS3 do not?
Hm, deployment to a server, handling user requests and dynamically generated webpages. You mentioned making an intricate website in a comment. I don't know what you mean by that, but a framework will let you do this way faster then without. Especially, if you only rely on client-side JS with static HTML5 and CSS3, I'm fairly certain you will have a hard time achieving your goal.
3.) HTML5 can also build dynamic web-pages as can Django. Why would Django be better for a dynamic web-page?
I'm not really sure you understand what dynamic means. Dynamic means generated from code, as opposed to static, which means served directly from an .html file. Django let's you do both, it's a framework and offers lots of flexibility.
If you want to serve same dish for all visitors to your site, HTML is fine. But if you want to server different dish to different user then you'll need ingredients and a way to churn them. Ingredients can be users, their profile and preferences, location, and other entities users are dealing with. Django is one way to churn all of these together and present (in HTML for example) to users.

Huge Django project

I have a new job and a huge django project (15 apps, more than 30 loc). It's pretty hard to understand it's architecture from scratch. Are there any techniques to simplify my work in the beginning? sometimes it's even hard to understand where to find a form or a view that I need... thnx in advance.
When I come to this kind of problem I open up a notebook and answer the following:
1. Infrastructure
Server configuration, OS etc
Check out the database type (mysql, postgres, nosql)
External APIS (e.g Facebook Connect)
2. Backend
Write a simple description
Write its input/output from user (try to be thorough; which fields are required and which aren't)
Write its FK and its relation to any other apps (and why)
List down each plugin the app is using. And for what purpose. For example in rails I'd write: 'gem will_paginate - To display guestbook app results on several pages'
3. Frontend
Check out the JS framework
Check the main stylesheet files (for the template)
The main html/haml (etc) files for creating a new template based page.
When you are done doing that. I think you are much more prepared and able go deeper developing/debugging the app. Good luck.
Use this http://packages.python.org/django-extensions/graph_models.html
to generate the Relationship diagrams from the models so that you can visually see how the models are related to each other. This will give you nice idea about the app
1) Try to install the site from scratch. You will find what external apps are needed for the site to run.
2) Reverse engineer. Browse through the site and try to find out what you have to do to change something to that page. Start with the url, look up in urls.py, read the view, check the model. Are there any hints to other processes?
3) Try to write down everything you don't understand, and document the answers for future reference.
I would clone the project so you can mess up endlessly.
Then I would start to reduce the code. "What happens if if just remove this function here?
Also get django debug toolbar:
https://github.com/django-debug-toolbar/django-debug-toolbar
A good terminal debugger is also golden, there are many out there, here is an example:
https://github.com/tomchristie/django-pdb
This allow you to halt the code and even inject and mutate parameters in runtime. Just like GDB in C.
If you use FireFox you can install FireBug on it and when you for example submit ajax form you can see at which url send you request after what you can easily find controller which work with this form data. At chrome this utility embedded by default and call by F12 key.

Data Driven Framework: Web/Desktop Camelot V Django etc

Wanting to get some feedback on frameworks. Web/Desktop. It doesn't seem to be much difference in most respects expect web can go everywhere and desktop can't.
For a small user base however using database database driven application, where 70% input would come from files, and 30% for the user. Would I get more benefit from a desktop based solution like Camelot Camelot or Dabo & Pyjamas matched against say Django, Grok, Plone or Pyramid?
I was going to learn django based largely on docs Django Book and apparent ease of learning. Thought i should check first before diving in if its the most appropriate.
For data driven project where display/input/reporting facilites(charts/graphs) required is there a best fit or a "better fit". Can't see that I would loose anything by using a web framework for this these days, but where the desired output is more "business" logic based rather than a web page which avenue should i go web v desktop and if either better option?
Edit: I have found another possible solution/answer web2py web2py
I think you'll find web2py very easy to learn and use. Note, if desired, you can easily distribute your web2py app to individual users for installation on their own computer like a desktop app (using the browser as the user interface) -- see here. The users don't need to have anything else installed on their computer (not even Python), and web2py itself doesn't require installation, just unzipping.

I need a good web development framework for Python

I'm a C/C++ developer and I also have experience developing web apps with C#, ASP.NET MVC and fluent nhibernate. I'm looking for non-MS alternatives for web development and I'm really interested in python so I went out after Django but I've been told that Django makes it difficult for me to personalize my HTML (not sure if this is accurate).
What I'm looking for is a Python web development framework that is integrated with an ORM, is able to generate the interfaces BUT provides an easy way for me to customize the interface to create an AJAX intensive app
go for django.
does all you wanted,
has perfect docs and even free book,
partially runs on appengine,
has really large user base,
it is mature:
db sharding, (With model router)
xss protection in forms
memcache,
localisation,
well tested support for unicode,
really easy to learn because of level of it documentation.
I'm using Flask (a very minimal web framework) and SQLAlchemy as my ORM. I'm exceedingly happy with it. Disclaimer: I'm only using this for personal projects at the moment, though I do plan to launch a web app in the next 6 months using this setup.
Various options in Python you can look at -
Django (obviously!)
Pylons
Nagare
Flask
Django is really good. And no your info is not correct, HTML templates are real easy to edit them.
Also this is from a developer of Nagare -
Ajax without to write any Javascript
code or the use of continuations makes
a Web application looks like a desktop
one. In fact we have often found that
developers like you, without prior Web
experiences, can be quicker to get
Nagare because they have nothing to
"unlearn".
I am going deeper into this framework Since you said that your app is AJAX intensive. From what I have heard, Nagare makes it easy to do so...
All these frameworks are really good. Some are really good in some areas, others not. So may be explore them all & see which best suits your purpose.
For Web applications development, we're using Nagare, coming with YUI for AJAX communications.
Having a look to Nagare might be an option.
I'm in agreement with the rest of the answers and think that Django is by-far the best choice as a "complete framework" and I think their template system is second-to-none.
If you are looking to create an ajax intensive application, I'd suggestion checking out django-piston (http://bitbucket.org/jespern/django-piston/wiki/Home). Piston is a REST API framework built on top of Django. I've used it for a number of ajax intensive applications and have found it's workflow to be incredibly clean, quick and flexible.
If you are wanting to go a bit slimmer and lighter-weight though, I'd suggest checking out web.py (http://webpy.org/) or Tornado (http://www.tornadoweb.org/).
I would definitely look into Pylons which is very thoroughly documented and has sql alchemy (one of the best python ORM's) baked in. Plus it's easy to setup and learn.
I currently am working with a framework called restish which is flavor of pylons that (surprise, surprise) puts the focus on sticking to RESTful web design. I don't think it's exactly what you're looking for in that it lacks good documentation and any form of an ORM.
Just A side note I'm pretty sure that Django uses Mako templating which gives you excellent control over the HTML.

Categories