Does anyone know if it is possible to use Coffeescript on Google App Engine? If so how can this be done with the app engine Python or Go platforms?
Coffeescript compiles to Javascript, which can be run in a web browser. In that case, App Engine can serve up the resulting javascript.
I don't know of any way to compile coffeescript to python, java or go though, so you can't use it as a server side language.
It's possible.
1. Script Tag Method
You may use the Coffeescript compiler:
http://coffeescript.org/extras/coffee-script.js
Add it into your page header:
<script type="text/javascript" src="/coffee-script.js" />
<script type="text/coffeescript" src="/your_script.coffee" />
Use this method for testing or lite-app
2. MediaGenerator for Django
If you use Django frameworks, this may be the best for you:
http://www.allbuttonspressed.com/projects/django-mediagenerator#coffeescript
It will compile your coffeescript and get things done for you!
final few words: I am newbie in development. I only can read JS but like Coffeescipt a lot. After a lot of exploration. I finally choose Ruby on Rails instead of Python on some frameworks. Because asset pipeline is less-config and easy to learn for me. BTW, Python is still my favour language over Ruby XD
Related
I am new to web-sites field and I was wondering if you can make a simple personal website using only python (NO HTML, CSS, JS) and flask. I was searching a bit on the internet and didn't find any good examples.
Is it possible? And if it is any code examples?
I vould appreciate if you have any suggestions or exaples.
Here is what I want my website to look like(it doesn't need to have this many functions): https://palletsprojects.com/
Flask can be used for making realy simple websites with only basic text on them. But if you want a more developed website with more functions and a nicer desing you need to use html and css, and than you can use flask and python to implement 'logic' to them.
Here is a python flask tutorial:https://www.youtube.com/watch?v=MwZwr5Tvyxo
I am quite new to coding, and have limited experience with HTML and Python. I would like to develop a web page for personal use, and I thought it might be easier to starter with a template and customize it from there. Can anyone recommend a place to find some free templates, or know a good place to start looking?
I learned how with Flask using this tutorial. It's for creating a blog, but you can apply the concepts to other types of websites.
It is time consuming and will feel cumbersome at first, but it teaches you some extra things you need to know if you want the web page to be interactive, store data, etc.
Start Bootstrap is a great starting place! https://startbootstrap.com/ It has free, open source templates that you can use and let you become more comfortable with bootstrap.
Although I do recommend going through W3 tutorials https://www.w3schools.com/html/ and really familiarizing yourself with HTML and CSS if web development is of interest to you.
I'm just curious for future reference, how exactly would I link a python program and how would the code be worded to a html document.
Thanks in advance
Here is a list of frameworks you can check out:
https://wiki.python.org/moin/WebFrameworks
I prefer Django but that's just a personal opinion:
https://www.djangoproject.com/
Frameworks make it easier than ever to build applications and websites. Learn python well, learn how the web works, follow a few tutorials (for example the django tutorial) and you are ready to start developing.
Here is how Django works with templates(html):
https://docs.djangoproject.com/en/1.11/intro/tutorial03/
You could use frameworks like django and flask.
i always prefer flask. its simple and light
I would like to know what is the exact process to follow when building a web application using bootstrap python and django. Is bootstrap simply a template of HTML and CSS files which should be manipulated.
Pretty simple process actually!
Download the bootstrap file here (the first option)-
http://getbootstrap.com/getting-started/#download
Place the folder into your main app's static folder. You can then start to use classes from bootstrap in your HTML.
Make sure your static assets are set correctly so Django knows where to find the bootstrap components. Here's a detailed tutorial if you need more help. http://www.effectivedjango.com/tutorial/static.html
Bootstrap are mainly CSS and Javascript files that you can use from your web application html. You can use whatever backend you want with it.
I suggest that you should use django-bootstrap3. This package is easy to use and has an active development support. For detailed docs, please read this.
Also you can look at django-twitter-bootstrap to try out another option.
I would like to change the logo of a website based on which menu is currently activated/seen by the user browsing the website.
For instance I have www.urltowebsite.com/menu1 = Header Logo 1
And then I have www.urltowebsite.com/menu2 = Header Logo 2
And on top of this I want to add an else statement stating that: If any other menu is selected, use header logo 3.
How can I make this possible with Python? I cant seem to wrap my head around what to define where and how to call up the different functions on the HTML website.
Oh and I insist doing this with Python. And preferably without any framework such as Django. But if needs be I can install web.py
EDIT:
Am I forced to go with php then? I would like to once and for all start utilizing Python on my web projects.
The website is made in simple HTML as I said first. The Javascript functions are only used to serve the HTML menu's through AJAX. Again this does not matter much for what I am trying to do, as menu's have classes and I can define those in php and thus change my logo/header.
What I want to do is to use Python in this instance. Here is a code snippet from the site:
<div id="header">
<span class="title"><img src="http://www.url.com/subfolder/images/logo.png"/>
</span>
</div>
And some more relevant to this:
<div id="menu">
<ul>
<li>001</li>
<li>002</li>
<li>003</li>
<li>004</li>
<li>005</li>
<li>006</li>
<li>007</li>
<li>008</li>
</ul>
</div>
So can I use python here?
You're asking to do the wrong thing the wrong way.
In order to change the logo based on the URL in Python , you need Python to generate the page and know what that url is.
There are two ways to do that in Python:
Use an existing Web Framework
Write your own Web Framework
"Python" doesn't know or care what your URL is - the frameworks and support libraries ( Django, Pyramid, Bottle, Flash, Tornado, Twisted, etc) figure out what the URL is by an integration with an underlying web server ( though some have their own webserver coupled in ). Similarly, PHP doesn't really know or care what the URL is - that information comes from an integration with Apache or FCGI/Nginx/etc. PHP tends to ship with most/all of that integration done. It's also worth noting that PHP is not just a language, but a web framework. Python is just a language.
Most Python frameworks will be written to the WSGI spec and have a "request" object that has all the data you want ( and many use the WebOb librbary for that ).
If you plan on doing everything with static HTML files, then you have a few options:
have a single static directory. use javascript to figure out the addressbar location, and render the corresponding logo / write the headers & footers.
have a "template" directory of all your HTML. use a Python script build a static version of each website with the custom headers/footers and configure your webserver to serve a different one for each domain.
No, Python cannot run inside the HTML web page. If you're really serving plain HTML pages then you must use javascript to execute code in the browser once the page is loaded. However, since you mention using AJAX, it sounds like it's not really true that you're serving plain HTML but rather have some server side code. If so, that server side code is the place to put your HTML-construction logic. To know the best way to do that, you would have to describe what's happening on the server.
Although I haven't used it, I have heard that the pyhp project more or less provides php-like embedded functionality for python.