Flex最后一行左对齐

<% if (is_home()) { %>

<%= post.title %>

<% } else { %>

<%= post.title %>

<% } %>
<% if (post.excerpt && is_home()) { %> <%- post.excerpt %> <% } else { %> <%- post.content %> <% } %>

[Web design] Deploy web2py server with Nginx in Debian

Web2py is a great python web platform. However I don’t find any article on how to integrate it to Nginx. I also found a few issues that were not that easy to solve.

Web2py doesn’t need to be installed. Simple download the latest version.

cd /www
wget http://www.web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
rm web2py_src.zip

Install uwsgi by:

apt-get install uwsgi
apt-get install uwsgi-plugin-python

Add a setting profile to /etc/uwsgi/apps-available/web2py.xml

<uwsgi>
    <socket>/tmp/web2py.socket</socket>
    <pythonpath>/www/web2py/</pythonpath>
    <mount>/=wsgihandler:application</mount>
    <master/>
    <processes>1</processes>
    <harakiri>60</harakiri>
    <reload-mercy>8</reload-mercy>
    <cpu-affinity>1</cpu-affinity>
    <stats>/tmp/stats.socket</stats>
    <max-requests>2000</max-requests>
    <limit-as>512</limit-as>
    <reload-on-as>256</reload-on-as>
    <reload-on-rss>192</reload-on-rss>
    <uid>nginx</uid>
    <gid>nginx</gid>
    <no-orphans/>
    <plugins>python</plugins>
</uwsgi>

make a link to app-enable:

ln -s /etc/uwsgi/apps-available/web2py.xml /etc/uwsgi/apps-enabled/

restart uwsgi service:

service uwsgi restart

Modify nginx vhost file, adding the following to server section:

        location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
            alias /www/web2py/applications/$1/static/$2;
            #remove next comment on production
            #expires max;
        }
        location / {
            root /www/web2py/applications/;
            uwsgi_pass      unix:///tmp/web2py.socket;
            include         uwsgi_params;
            uwsgi_param     UWSGI_SCHEME $scheme;
            uwsgi_param     SERVER_SOFTWARE    nginx/$nginx_version;
        }

change the folder name as you need. Go to /www/web2py directory and set the password for 80 port, change owner of the folder to nginx:

chown -R nginx:nginx /www/web2py
cd /www/web2py
sudo -u nginx python -c "from gluon.main import save_password; save_password(raw_input('admin password: '),80)"

till now, you should be able to visit the default welcome project by the top level domain.

If you need to deploy the project at a subdirectory, you need to change the nginx settings to:

        location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
            alias /www/web2py/applications/$1/static/$2;
            #remove next comment on production
            #expires max;
        }
        location /app/ {
            root /www/web2py/applications/;
            uwsgi_pass      unix:///tmp/web2py.socket;
            include         uwsgi_params;
            uwsgi_param     UWSGI_SCHEME $scheme;
            uwsgi_param     SERVER_SOFTWARE    nginx/$nginx_version;
            uwsgi_param SCRIPT_NAME /app;
            uwsgi_modifier1 30;
        }

Web2py is located at http://yourdomain.com/app now. Due to the security reason, by default, web2py doesn’t allow you to connect from remote. To change this, you need to modify the file applications/admin/model/access.py by adding

request.is_local=True

before

if request.is_https:
    session.secure()
elif not request.is_local and not DEMO_MODE:
    raise HTTP(200, T('Admin is disabled because insecure channel'))

Replys:

  1. XaromaJem

    Some people don’t know, how it is probable to dwell without money. Your financial power depends on position in your life. Today money supports to solve diverse lifestyle problems. Exactly credits and loans support if you haven’t option to pay later. You may work every day, but family costs can be very major. That is the reason, why young people ask in Google, where it is feasible to take a loan online. Working to improve your credit history online assist ensure you will qualify for online loans when you need them, by the way, anywhere.

    Sure, you can search firms, which suggest your some options. It can be individual financial organizations or banks. If you wish to get on long short bad credit loans, you must find the company, which provides the best bad credit loans. It can be WebMoneyLoans company, more information about it you may read at webmoneyloans.com.

    Now, you may got bad credit loans in Virginia money, if you are a student or businessman. This website is working all over the USA and Canada. You can use it also in Franca. More and more couples from diverse towns are visiting them. You can take payday loans in Alabama, even if you need more cash. Anyone doesn’t know when she or he needs some sum of cash. That is the main cause, why this website helps to permit diverse hard situations, which can be combined with usd.

    You must know, that the best payday loans online in Alabama you can get on a website. There are many diverse options, which can be interesting for you. Even if you are a driver or chemist and you need any money, you shouldn’t visit a bank. It is feasible to take payday loans online at the website. There are many guys, who don’t desire to visit banks. That is why the specialists proposes to get cash for your private wallet. It is possible to do it if you have your private wallet. It can be also Visa or MasterCard, where possible to have payday loans online 24/7 in Texas.

    If you are a undergraduate and you desire to receive money before your scholarship is coming, you could receive short term payday loans in ID. It is possible to do if you will go on at https://webmoneyloans.com/bad-credit-loans/bcl-mt where are a lot of options loans for undergraduates. If you have your line of credit in past at another link or banking account, you can add it, before you will get loans. You can make purchases with a line of credit before it will be changed. Commonly, users who visit the website, are using credit cards, which support to receive cash. Credit cards are very important in our lifestyle, even you have a diverse type of your revolving credit, you can use options, which propose webmoneyloans.com service.

    When someone takes payday loans with no credit check in Pennsylvania, this person, usually, is interested in interest rates. On the website, you can search information about interest rates. You should not be nervous about a certain percentage of the average daily balance, cause of all the options for all people are the same. You can get coins for your account after when you agree with the standard percentage. That is the cause, why students are interested in long term payday loans in Louisiana.

    People, who wish to have the best payday loans in Tennessee, must understand, that this link is their luck. As rule, in Ohio, there are banks or financial organizations, which give long term payday loans in Ohio. You can have quick approval payday loans in Dakota or another city. You shouldn’t be nervous about any fees, cause of a lot of financial companies included it. A lot of credit cards charge fees, diverse banks also charge fees, but the amount of fees is different. The firm propose for everyone support, you can talk with specialists at the chat.


Leave a Reply

Your email address will not be published. Required fields are marked *