Application » History » Version 3
Elmer de Looff, 2013-03-21 13:49
1 | 1 | Elmer de Looff | h1. Application |
---|---|---|---|
2 | 1 | Elmer de Looff | |
3 | 2 | Elmer de Looff | Provided with µWeb is a script named @uweb@ which when [[Installation|installed]] using @pip@ will be located on your path, i.e. globally executable. With this application you can create and manage µWeb projects and webservers for testing purposes. |
4 | 1 | Elmer de Looff | |
5 | 2 | Elmer de Looff | h2. Creating new µWeb projects |
6 | 1 | Elmer de Looff | |
7 | 2 | Elmer de Looff | New µWeb projects can be created (initialized) by running the @uweb init@ command. With this, you have to specify the name of your project, as follows: |
8 | 1 | Elmer de Looff | |
9 | 2 | Elmer de Looff | <pre><code class="bash"> |
10 | 2 | Elmer de Looff | uweb init boondoggle |
11 | 2 | Elmer de Looff | </code></pre> |
12 | 1 | Elmer de Looff | |
13 | 2 | Elmer de Looff | This creates a µWeb project named @boondoggle@ in the current directory. All the necessary files are copied to this directory and a router configuration entry is made (more about that later). What's important now is picking the right name for your project (of course, you can change it, but a good name gets you going). The script will do its thing and tell you when it's done: |
14 | 1 | Elmer de Looff | |
15 | 1 | Elmer de Looff | <pre> |
16 | 3 | Elmer de Looff | elmer@Penrose:~$ uweb init boondoggle |
17 | 2 | Elmer de Looff | +--------------------------------------------------------------+ |
18 | 2 | Elmer de Looff | | initializing new uWeb project 'boondoggle' | |
19 | 2 | Elmer de Looff | +--------------------------------------------------------------+ |
20 | 2 | Elmer de Looff | * copying uWeb base project directory |
21 | 2 | Elmer de Looff | * setting up router |
22 | 2 | Elmer de Looff | * setting up apache config |
23 | 2 | Elmer de Looff | +--------------------------------------------------------------+ |
24 | 2 | Elmer de Looff | | initialization complete - have fun with uWeb | |
25 | 2 | Elmer de Looff | +--------------------------------------------------------------+ |
26 | 1 | Elmer de Looff | </pre> |
27 | 1 | Elmer de Looff | |
28 | 2 | Elmer de Looff | h3. Error: Target already exists |
29 | 1 | Elmer de Looff | |
30 | 2 | Elmer de Looff | Sometimes you end up using the same really good name twice. µWeb will warn you that there's already a directory with the given name, it won't readily use this directory and destroy its contents. You can use the @-f@ flag to force the initialization in that directory. |
31 | 1 | Elmer de Looff | |
32 | 2 | Elmer de Looff | *N.B.*: This will delete any and all existing data in the target directory. It will not _merge_ the µWeb project. |
33 | 1 | Elmer de Looff | |
34 | 2 | Elmer de Looff | h2. Controlling the local testing webserver |
35 | 1 | Elmer de Looff | |
36 | 2 | Elmer de Looff | LLAA tool used to control stuff |
37 | 1 | Elmer de Looff | |
38 | 2 | Elmer de Looff | h3. Listing µWeb projects |
39 | 1 | Elmer de Looff | |
40 | 2 | Elmer de Looff | µWeb comes preloaded with a set of two example projects, and now our project is listed as well: |
41 | 1 | Elmer de Looff | |
42 | 1 | Elmer de Looff | <pre> |
43 | 2 | Elmer de Looff | elmer@Penrose:~$ uweb list |
44 | 2 | Elmer de Looff | Overview of active sites: |
45 | 1 | Elmer de Looff | |
46 | 2 | Elmer de Looff | +------------+---------------------------------+-------------+ |
47 | 2 | Elmer de Looff | | Name | Router | Working dir | |
48 | 2 | Elmer de Looff | +------------+---------------------------------+-------------+ |
49 | 2 | Elmer de Looff | | boondoggle | boondoggle.router.boondoggle | /home/elmer | |
50 | 2 | Elmer de Looff | | logviewer | uweb.logviewer.router.logging | / | |
51 | 2 | Elmer de Looff | | uweb_info | uweb.uweb_info.router.uweb_info | / | |
52 | 2 | Elmer de Looff | +------------+---------------------------------+-------------+ |
53 | 1 | Elmer de Looff | </pre> |
54 | 1 | Elmer de Looff | |
55 | 2 | Elmer de Looff | We can see three projects here: |
56 | 2 | Elmer de Looff | * Our newly initialized @boondoggle@ project, aspiring to be the new social media synergy machine. |
57 | 2 | Elmer de Looff | * @logviewer@, which is a handy viewer for µWeb's SQLite logfiles |
58 | 2 | Elmer de Looff | * @uweb_info@, a demonstration project for various µWeb functionalities and abstractions. |
59 | 1 | Elmer de Looff | |
60 | 2 | Elmer de Looff | h3. Starting and stopping µWeb projects |
61 | 1 | Elmer de Looff | |
62 | 2 | Elmer de Looff | µWeb projects by default run on port 8082 (and bind to all IP addresses on the machine, so they're also reachable by other people on the network). This can be configured by changing the configuration files for [[Standalone]], and in fact the two projects that come with µWeb run on different ports: |
63 | 1 | Elmer de Looff | |
64 | 2 | Elmer de Looff | * The @logviewer@ runs on port 8001 |
65 | 2 | Elmer de Looff | * @uweb_info@ runs on port 8000 |
66 | 1 | Elmer de Looff | |
67 | 2 | Elmer de Looff | Starting a µWeb project using the @uweb@ application is simple enough: |
68 | 1 | Elmer de Looff | |
69 | 1 | Elmer de Looff | <pre> |
70 | 2 | Elmer de Looff | uweb start boondoggle |
71 | 1 | Elmer de Looff | </pre> |
72 | 1 | Elmer de Looff | |
73 | 2 | Elmer de Looff | You can then point your webbrowser to http://localhost:8082/ and you'll be greeted with a basic HTML page welcoming you to your new project. |
74 | 1 | Elmer de Looff | |
75 | 2 | Elmer de Looff | The development server can be stopped or restarted using the @stop@ and @restart@ commands: |
76 | 1 | Elmer de Looff | |
77 | 1 | Elmer de Looff | <pre> |
78 | 2 | Elmer de Looff | uweb stop boondoggle |
79 | 1 | Elmer de Looff | </pre> |
80 | 1 | Elmer de Looff | |
81 | 2 | Elmer de Looff | h3. Adding / removing and updating routers |
82 | 1 | Elmer de Looff | |
83 | 2 | Elmer de Looff | h3. Creating Apache configurations |