Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Are there efficient practices for leveraging an HTML IDE with Python (No Framework) instead of the typical outputting of hand coded HTML in python programs that you can't use HTML IDE's with?
I loved the way PHP, JSP, Classic ASP, and .net allow you to include server side code in HTML with the <% tags. I know some think this is poor form but I personally could stay highly organized with include files while leveraging the WYSIWIG HTML IDE's for presentation polish and experimentation as well as code intelisense.
FYI: I have gone the IIS ASP route but it just isn't working anymore for anyone I could find online using the latest versions of IIS(8.0). I'm completely open to other web servers/approaches just so long as its something efficient and would supportable from a reputable remote web hosting provider.
Thank You!
Tim
Django (https://www.djangoproject.com/) and Flask (http://flask.pocoo.org/) both let you use template languages which let you manipulate and customize HTML pages. However, these processes differ from PHP-style systems in that the code in the HTML page is only related to how you view the data in the page. The bulk of the processing happens in the python code, or the controller (MVC frameworks)
Django's template language: https://docs.djangoproject.com/en/dev/topics/templates/
Flask's template language (Jinja2): http://jinja.pocoo.org/docs/
Have a look at Mako template library. It is very easy to use, and yet powerful (usage documentation).
Also, I believe that other popular template libraries can be used outside of a framework as well.
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"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 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 2 years ago.
Improve this question
I actually have multiple questions about web development with a Chromebook. my apologies if this is long. So far, i have very little knowledge in HTML and CSS and am looking to expand (curious about python currently), but it seems to be very uncut with a Chromebook and highly confusing at times. so here are my questions:
Is Caret a good text editor for Chromebook? And are there any tutorials on how to use Caret or what it is fully capable of?
Is python downloadable on a Chromebook, and what are some good places for a beginner to learn how to use python?
Are there any ways to turn an html document into an actual website, like one you can view on any device with a domain name and all that?
Thank you to anybody who can answer these questions or any information regarding. There isn't much on all this online that i have been able to find. Any help is very much appreciated!
If you've not found an answer yet, I might be able to help on questions 1 & 3...
Q1
Caret is the best text editor that you can run directly on a Chromebook (as opposed to using an online editor like Cloud9, which is great but more complicated to setup). I've used it for a couple of years and love it.
The best place to find advice on using it is on the creator's website. It's not particularly complete but covers most things. And anyhow, it's basically a pretty simple app.
Q3
However... it is an editor, not an 'IDE' (integrated development environment) - which is why you can't work out how to see an HTML doc as an actual webpage. The functionality isn't built into Caret.
The good news is that there is a very simple way to do this. Get the Chrome extension 'Web Server for Chrome' - available here. This allows you to choose the folder where you've saved the HTML (and any CSS / JavaScript) and gives you a link to view it in the browser. It's dead easy!
...and Q2
Coming back to q2 about Python. I've not tried myself but I would guess it's possible. This is more challenging as you need to use the command line and configure your Chromebook. If you follow the instructions on this page (jump down to the section called 'The Termux Secret Sauce') that did the trick very neatly for me. You need to use an SSH client and the Chrome extension by Google is very simple to use.
Once setup, you can then just Google instructions on running Python on Linux.
Hope all that helps.
PS if you get into more coding, the benefits of an IDE are significant. Just the autocompletion and code formatting alone make life much easier than with Caret. I used Cloud9, which is part of AWS. You can get a free-tier EC2 virtual machine to run it off, but there's some faffing around to be able to view webpages from your browser.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
i have a mysql database that i'd like to query. i would like to format the results a certain way, then turn it into a pdf. in the past, i used PHP and FPDF, while it worked, it was a pain and tedious. i don't think PHP can handle this sort of thing. i don't have much experience in python or ruby but this would be a great project to do in either language so i can get more familiar. it doesn't have to be web based. it can be desktop script that i could run with a cron or manually. hope someone can point me to some resources. thanks.
In Ruby you have a number of options for your PDF authoring, and your DB management is very easy if you use the ActiveRecord library (comes with Rails) or Sequel to read or write data.
Complete and heavy duty PDF authoring can be done using Prawn... it requires some studying, but it's an amazing library.
You can also create HTML web pages and convert them into PDF using the wicked_pdf gem, which is quite simple to use.
Or, you can combine it all, or write simple PDF's with simple tables and text using the combine_pdf, which is as easy as it gets and also allows you to use PDF templates (so you can have a well designed template and just add the text you need).
I love Ruby and I think it's very easy to learn. Plus, it has more applications than just web programming - there's even a project called RubyMotion which lets you program native applications for iOS and Android using Ruby!
I'm sure you'll love Ruby.
In Python, you can use pyPdf to create PDF files. As for the querying a mySQL DB, you can use mySQLdb. Installing it is slightly harder than other modules, but once you have done so, it's just like any other sql package. Hope it helped.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm looking to get into web development. My goal is to create some interactive webpages that interact with MS SQL databases (read/insert/updates), and also possibly sites that interact with XML files.
I've got some basic understanding of Python and Perl scripting. Can someone point me in the right direction in either of those languages to accomplish what i'm looking to do, or if it's easier to accomplish in another language what would that be?
Apologies if my stated goal is too broad.
I'd strongly suggest you to look into some of the web development frameworks. They take care of many low-level tasks which is needed in order to build a solid web page. I'm not very familiar with perl, so I can only suggest Python frameworks, especially one of the my favourites - Django. It has very good documentation which is essential for the first-timer. I believe you should be fine as long as you follow the official documentation.
Good luck
You can use SQL Alchamy in python, and lxml or the default ElementTree xml module for simple cases.
I have done both for a webservice I maintain, and they work nice.
You can also use a web development framework. I personally suggest Flask based on that it is a lightweight framework as opposted to django for instance. However, depending on your exact use case the latter might be better.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I heard a lot of people talking about Django on various forums. But I am having a very basic question : What is meant by Framework and why Django is used.
After listening a lot about Django, I ran few chapters for Django (from Djangobook.com). After running these chapters, I am wondering how Django can be used to create a very simple website. (Website should have few pages like Home, Favorites, About, Contact linked to each other and will be providing static content).
Can Django be used for creation of such website? I searched a lot on internet but couldn't find any relevant examples, I only encountered with the examples for creation of blog, forum sites etc. If Django can be used for creation of this website, what should be the approach.
Can someone please explain this basic term "Framework" and its significance?
No. It's not for making websites. Your sample just sounds like you want plain old HTML.
Django is for creating web applications. That is, software, normally backed by a database, that includes some kind of interactivity, that operates through a browser. A Framework provides a structure and common methods for making this kind of software.
I think what you're looking for is a very simple CMS (Content Management System), there are many of those available in all kinds of languages/frameworks. Django has django-cms and mezzanine (among others).
What django is really awesome at is building dynamic websites really fast, you don't need to worry about most things, you just define your data model and off you go (almost). If you want to have a better insight into what's possible, have a look at the django tutorial (under "First Steps"), it gives you a good introduction to django and how to build websites using it.
Django can be used to create dynamic high-security web applications. For creating a static website like the one you asked, HTML is enough.
Tutorial for creating a django application can be found here.