Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Basically I want to create a sexy GUI using HTML5 then call code that I wrote in python. I have just discovered some tutorials about web2py, however I am getting the videos now from youtube so I can only watch when I get home. (Life of a student with no internet at home).
So basically I have written a python script, now I want to use a webpage to interact with that script instead of terminal as I have been doing. So I have a webpage provide me the GUI to my python app.
Hope this makes more sense.
Any help and direction will be greatly appreciated.
Thanks in advance
You need to flip that around, you want to run server-side python code that renders your sexy HTML5 GUI. There are many Python frameworks that are suitable to this, including web2py, django, and my personal favorite flask.
Any of these frameworks will let your python code run, then render the HTML with python variables/functions available by using a templating engine (for example Flask uses Jinja template). Tutorials are readily available for all of these python libraries, but if you want to take a look at Flask, I can recommend Miguel Grinberg's excellent tutorial series.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I am proficient in Bash and a beginner in Python (I have some experience with Flask and Requests).
I wrote a Bash script which asks for some input (four strings) and creates a configuration file based on that input. That's good for me, but I would like to convert it to a (no frills) web interface. I know how to configure Apache, if necessary.
I know there are zillions of ways to do that. I'd like some hints on how to tackle my problem, ideally using Bash or Python. By the way, I've used Octave on CGI for some of this in the past, and I think it's excellent for math purposes, but I'd like to get ideas about some simpler, more generic avenues.
I would create a Django site for this. It can be setup really quickly. I would recommend you host it on PythonAnywhere. They have a free tier, and works really well. Django is similar to Flask, but I personally like Django. If you could be more specific on what your App needs to do, some sample code could be provided.
You probably just need the right keywords to go the right direction. From a high level all you need to to is two steps:
Create a static html web page that contains a form. This form contains at least one input field and a submit button. The URL it accesses needs to be understood by your webserver to invoke your script via the common gateway interface (CGI).
write a python or bash script that Apache can invoke via CGI that receives the value and does something about it. The stdout of this script will be returned back to the browser, so it better be HTML again.
For details check out http://httpd.apache.org/docs/2.4/howto/cgi.html
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I"m not entirely certain what I'm trying to do is doable.
I want a ready made website that I can make live fairly quick but later modify it with python code. I have basic python knowledge and used it, as well as SQL regularly as a BSA at a past job.
I also have some experience with HTML, though I would need a heavy brush up to actually build a website. We focused more on flash at the time. (15 years ago or so).
I want a basic templated website that I can make live with very little customization and gradually learn and modify it with python.
If I'm understanding correctly, you can't run python in html, but you can run html in Django.
I read about Django Templates but not entirely certain this will be ready to go without some serious python webbev knowledge.
Is it possible to have Django framework run an html templated website? Or are Django templated websites easy to customize and make live?
It sounds like you're missing a fundamental understanding of frontend and backend and how they interact. What you're referring to with "running HTML in Django" is called SST - Server Side Templating. You can write a template using HTML plus some markdown that Django understands (e.g. to inject variables/data from backend), and Django will render that template on the backend and serve it as an HTML document (i.e. a web page).
Django can be a bit heavyweight for beginners, I would recommend looking at Flask as it is much simpler to get started - you can have a Flask application up and running in less than 10 minutes. You can find the Flask quickstart guide here - the minimal "Hello World" application is only 5 lines of code.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm newbie in GAE and just trying to work out basic principles of my future web app. So I looking to java to design my app. And I want realize which is better way to create admin panel? An admin should be allowed to manage posts and users for example.
I heard that Django has build-in admin panel, but I do not experienced in Python.
The great thing about going the Python/Django route is that there are great tutorials that walk you through the process step-by-step.
One example.
Google's own example of how to get Django running.
Another example, but be more careful with this one: it's slightly out-of-date. Still a good reference though.
If you're comfortable with programming, Python is a very easy language to pickup. As you mentioned, Django provides a great admin interface that does a lot of the work for you.
If you do decide to use Java, you'll have to build the admin interface from scratch, which generally takes quite a bit of time (if you want to do it right and do it well). I recommend that you use a framework to help you in the process, and here Google has some documentation on which frameworks work in GAE.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm new to web development and going to make a website which responses with data received from request to web-service(facebook for e.g.) and how to choose what is more useful here:
nodejs has an callback model which allows not to wait while gathering data for user from other services (but i've broken my fingers and my brain after trying to make a kind of class in javascript with inheritance and the whole server drops after unhandled error in script)
python is very convinient in working with diff. kinds of data, it's more convinient for me, former C++ developer
yesterday i've read about twisted python that also uses callbacks
Help me please to choose what to use, better - performance, simple code
The callback model might make your code more verbose but WAIT! there is a solution! Check out
waitfor.
Anyway, if it's a personal project then no one is forcing you to use node.js for webapp development.You should go with what makes you more comfortable. If you like developing in python then go for it! :)
why don't you try django; it uses python (which you said is more convenient) and is also very commonly used for web development.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a python script written up and the output of this script is a list . Right now I need to get it online and make it accesible to others. I looked at Django , but then I realised that it may be kind of hard to create the UI. Is there any simple way to create a UI in Django and map it to an existing python script. Right now I am not using sql and things like that. Or is there a simpler way by which I can proceed?
I'd go with Flask or web.py.
Django pays off if you develop a large app; yours is not.
Probably all you need is two pages: one with an input form, and another with results. As long as your input is text, you should have little trouble taking input from a POST handler and passing it as is to your script.
Both microframeworks have tutorials: here's web.py's, and Flask's is right on the home page. Should get you started very quickly.