wheezy.web is a lightweight, high performance, high concurrency WSGI web framework with the key features to
build modern, efficient web. Here we will use an empty project quick start to build a new project.
-
Download quickstart-empty.zip and extract.
-
Rename extracted directory `quickstart-empty` to meet your project name, e.g. mysite and open terminal in that directory.
The empty project quick start comes with Makefile with several handy targets. Setup development environment:
make env
Let run test, look at coverage and finally benchmark tests:
$ make test nose-cover benchmark
....................................
..........
Name Stmts Miss Cover Missing
--------------------------------------------------
public 3 0 100%
public.web 0 0 100%
public.web.profile 5 0 100%
public.web.urls 10 0 100%
public.web.views 20 0 100%
--------------------------------------------------
TOTAL 38 0 100%
--------------------------------------------------
Ran 10 tests in 0.423s
OK
public: 5 x 1000
baseline throughput change target
100.0% 5041rps +0.0% test_root
81.3% 4097rps -18.7% test_home
99.4% 5008rps -0.6% test_error_400
100.3% 5055rps +0.3% test_error_403
98.7% 4975rps -1.3% test_error_404
static: 3 x 1000
baseline throughput change target
100.0% 4846rps +0.0% test_static_files
49.8% 2415rps -50.2% test_static_file_not_found
55.0% 2663rps -45.0% test_static_file_forbidden
-----------------------------------------------------
Ran 2 tests in 2.375s
OK
The tests are passed let run it in web browser:
$ make run
Visit http://localhost:8080/
Alternatively you can run it using uwsgi
env/bin/easy_install uwsgi
make uwsgi
Enjoy!
Awesome. I could have used this weeks ago when I was trying to hobble together something like that for starting with but it had way less features :) I'll probably change my current website to use this, I like the way you have everything laid out.
ReplyDeleteps. What is your thinking for the public/web structure? Is that so you could add public/api, private/web, private/api, etc if needed?
Thank you. I will add another quick start with i18n support shortly.
DeleteTypically any project can be split into several business areas, e.g. public (contact us, feedback, etc), membership (work with user profile and settings), funds, messages, etc. These areas perfectly map to python packages. Thus at the level where you see `public` package, there are those areas setup, then each area is layered `technically`: models, validation, repository, service and web. As an example you can take a look here:
https://bitbucket.org/akorn/wheezy.web/src/tip/demos/template/src/membership
Hi, nice work!
ReplyDeleteHow do you build the benchmark test?
Take a look at `benchmark` make target and unit test located at src/public/web/tests/benchmark_views.py
DeleteAre you able to create a tutorial explaining a starting point from this quickstart package? Just wondering because the documentation leaves out certain specifics that the quickstart package doesn't. For example, there is no mention about using a sources.txt for the python egg part that tells the template engine where to find "home.html" for example. This is not even mentioned anywhere. In addition there is also no mention of what appears to be a hard-coded "master.html" in the egg. The documentation has no mention of things being/needing to be this way. Also I noticed that the documenation does not mention any particularly desired directory structure such as the "public" and "shared". Although obvious to me after digging I would have rather read about it so I had a clear understanding.
ReplyDeleteNot sure where to post, anyway I'm posting it here. How can I write url route for robots.txt? In my urls.py
ReplyDeleteall_urls = [ url('robots.txt', file_handler(root='static/'), name='robots'), ]
which doesn't work.
1. create robots.txt in content/static.
Delete2. in public url mapping (src/public/web/urls.py) add the following to static_urls: url('robots.txt', static_file, {'path': 'robots.txt'}, name='robots').
In production deployment I would advise nginx to serve this file.
See you in freenode at #wheezy.web.
Thank you.
Delete