Blue Flood CDN Simple Web Refresh Program

Source: Internet
Author: User

Blue Flood CDN Refresh API collection is very convenient, but contains clear text account password, public very uncomfortable.

A small station was built in the beginner's python.

Baidu a bit, found that Nginx+uwsgi is currently a good production solution. (Nginx built-in UWSGI module, do not need to recompile)

Half a day to finish, share under convenient later query.

Nginx Related configuration section:

1 Server2         {3Listen the;4 server_name cdn.test.com;5 index index.html;6root/home/webpy;7Location/8                         {9 include Uwsgi_params;TenUwsgi_pass127.0.0.1:18888; One                         } A  -access_log/home/wwwlogs/access.log access; -}

To refresh the app code:

1 ImportWeb,urllib2  fromWebImportform3 4 5URLs = ("/.*","Flush")6App =web.application (URLs, Globals ())7application = App.wsgifunc ()#without this paragraph, UWSGI cannot identify the application.8 9Render = Web.template.render ('Templates')Ten  One  AFlush_form =form. Form ( -Form. Textarea (name='URLs', value="', Rows=20, cols=180), -Form. Button ('Flush', type='Submit') the     ) -  - classFlush: -  +     defGET (self): -f =Flush_form () +         returnRender.flush (f) A  at     defPOST (self): -data = Web.data (). Replace ('&flush=',"') -Urllib.urlopen ('http://ccms.chinacache.com/index.jsp?user= user name &pswd= password &ok=ok&' #用户名密码自己加 -+data) -         return 'Flush successed. Check back 5 mins later.' -  in if __name__=="__main__": -App.run ()

Template page:

$def with (URLs)<H1>Flush CDN</H1><BR/><b>Example</b>&nbsp;Http://p0.test.com/Resource/Images/home/twocode.jpg<BR/><BR/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Http://s0.test.com/Resource/Js/common/jquery-1.8.3.min.js<BR/><BR/><formMethod= "POST">$:urls.render ()</form>

Start Uwsgi:

Need to switch to the directory where the app is located

Uwsgi-s 127.0.0.1:18888-w hellow-p--master-p--max-requests +--uid www--gid www-d/home/wwwlogs/uwsgi.log

Blue Flood CDN Simple Web Refresh Program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.