Graphics Reference
In-Depth Information
Setting
up
a
local
web
server
with
Python
The best way to test your Three.js applications, or any JavaScript application for that
matter, is to run it on a local web server. This way, you have the best representation of
how your users will eventually see your Three.js visualization. In this chapter, we will
show you three different ways in which you can run a web server locally. The three
different ways to set up a local web server are:
• One way to do this is via a Python-based approach that you can use if you've
got Python installed
• Another way is to do if you use Node.js or have already played around with
Node.js, you can use the npm command to install a simple web server
• A third option is if you don't want to use the npm command or Python, you can
also use Mongoose , which is a simple portable web server, that runs on OS
X and Windows
This recipe will focus on the Python-based approach (the first bullet point).
Getting ready
If you've got Python installed, you can very easily run a simple web server. You will
first need to check whether you've got Python installed. The easiest way to do this is
just type in python on a console and hit enter . If you see an output as follows, you
are ready to begin:
> python
Python 2.7.3 (default, Apr 10 2013, 05:09:49)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license"
for more information.
>>>
Search WWH ::




Custom Search