shop
配置
ngrok
ngrok下載和基本使用
從https://ngrok.com/ 下載ngrok
然后注冊一個賬號 獲取官方分配一個密鑰
Install your authtoken
./ngrok authtoken xxxx
Create your first secure tunnel
./ngrok http 80
Open the web interface at http://localhost:4040 to inspect and replay
read doc https://ngrok.com/docs
for instructions on advanced features like adding HTTP authentication, setting custom subdomains and more.
使用cmd 到ngrok.exe的目錄
ngrok -authtoken 密鑰 -subdomain 二級域名 端口
ngrok -authtoken xxxx -subdomain yyyy 8000 #這個二級域名也要付費才有了
最簡單的命令是
ngrok http 8000
下面介紹全免費的方案
使用默認配置文件
default location of config file is $HOME/.ngrok2/ngrok.yml.
windows下面
C:\Users\Administrator.ngrok2\ngrok.yml
authtoken:
tunnels:
myshop-http:
addr: 8000
proto: http
#subdomain: myshop-inspect 這個要付費才有
inspect: false
然后在console钧舌,運行
ngrok start myshop-http
Rabbitmq server
celery4.x 不再支持windows
pip install celery==3.1.18
rabbitmq in windows
rabbitmq 支持的OS多過redis竣灌,在windows安裝了一個 可以用
cd /d D:\RabbitMQ Server\rabbitmq_server-3.6.9\sbin
windows下面配置rabbitmq
http://www.rabbitmq.com/configure.html#customise-windows-environment
run the following command after installation on rabbit mq path:
rabbitmq-plugins enable rabbitmq_management
#下面的服務(wù)啟動是會失敗的懈涛,如何配置為windows service看下面
rabbitmq-service.bat start
下面的命令受啥,可以在console看到消息
rabbitmq-server.bat start
如何要運行為windows service
RABBITMQ_BASE是用來放db和log兩個目錄的,
默認是在C:\Users\Administrator\AppData\Roaming\RabbitMQ
RABBITMQ_BASE=D:\RabbitMQ Server\rabbitmq_server-3.6.9
rabbitmq-service.bat uninstall
rabbitmq-service.bat install
rabbitmq-service.bat start
rabbitmq in linux
paypal
Creating a PayPal account
You need to have a PayPal Business account to integrate the payment gateway into your site. If you don't own a PayPal account yet, sign up at https://www.paypal.com/signup/account.
Make sure that you choose a Business Account and sign up
to the PayPal Payments Standard solution, as shown in the following screenshot:
pip install django-paypal==0.3.6
http://django-paypal.readthedocs.io/en/stable/
http://developer.paypal.com
注冊sandbox賬號
包括business和person賬號,這個是用來模擬買賣中的賬號來的。
person賬號初始化的balance是$9999.
WeasyPrint使用它的轉(zhuǎn)換功能(輸出pdf file)
目前為止PyGTK只支持py2.7,所以確保在python2.7的環(huán)境
否則就只能去掉WeasyPrint
發(fā)布運行(以ngrok發(fā)布為例):
因為某些app要用到static下面的靜態(tài)文件兜辞,所以需要運行下面的命令
python manage.py collectstatic
開4個console
ngrok
ngrok start myshop-http
這時候會顯示外網(wǎng)url,以后就用這個url訪問myshop購物
django myshop
workon myshop
cd /d e:/django_projects/shop/myshop
python manage.py runserver 0.0.0.0:8000
rabbitmq server
cd /d D:\RabbitMQ Server\rabbitmq_server-3.6.9\sbin
rabbitmq-server start
或者啟動service
celery
workon myshop
cd /d e:/django_projects/shop/myshop
(myshop) e:\django_projects\shop\myshop>
celery -A myshop worker -l info
因為報錯:pickle被rejected夸溶,所以把下面的配置注釋掉了
CELERY_ACCEPT_CONTENT = ['application/json']