Skip to content

Instantly share code, notes, and snippets.

@creamidea
Last active August 29, 2015 14:00
Show Gist options
  • Save creamidea/11364445 to your computer and use it in GitHub Desktop.
Save creamidea/11364445 to your computer and use it in GitHub Desktop.
mushroom-configure-file
# ########################################################################
# mushroom website
# 写完这个之后不要忘记 sudo a2ensite 来激活
WSGIPythonPath /home/icecream/NodeSite:/home/icecream/mushroom/lib/python2.7/sit
e-packages
# WSGIDaemonProcess site-1 processes=2 threads=25 display-name=%{GROUP}
# WSGIProcessGroup site-1
<VirtualHost *:8080>
ServerName 127.0.0.1
ServerAlias site-1
DocumentRoot /home/icecream/NodeSite
WSGIScriptAlias / "/home/icecream/NodeSite/NodeSite/wsgi.py"
<Directory "/home/icecream/NodeSite/NodeSite">
<Files wsgi.py>
Require all granted
</Files>
Order deny,allow
Allow from all
</Directory>
Alias /robots.txt /home/icecream/NodeSite/static/robots.txt
Alias /favicon.ico /home/icecream/NodeSite/static/favicon.ico
Alias /static "/home/icecream/NodeSite/static"
<Directory "/home/icecream/NodeSite/static">
Require all granted
Order deny,allow
Allow from all
</Directory>
ErrorLog "/var/log/apache2/mushroom-error.log"
CustomLog "/var/log/apache2/mushroom-access.log" common
</VirtualHost>
INSTALLED_APPS += (
# django开发工具,
# 用于coffee->js
# compressor
'pipeline',
)
MIDDLEWARE_CLASSES += (
# Compressor
'django.middleware.gzip.GZipMiddleware',
'pipeline.middleware.MinifyHTMLMiddleware',
)
# PIPELINE_ENABLED = False
# Disable Wrapped javascript output 去除最外层的包装
PIPELINE_DISABLE_WRAPPER = True
# 使用的存储方式
# 这个cached貌似会造成apache 500
# STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
# 在windows下开发,需要加入这句,否则将会报错:
# CompressorError: The system cannot find the path specified.
# 这个应该是路径配置问题,在Windows上的路径配置实在太让人纠结了。
PIPELINE_YUGLIFY_BINARY = 'yuglify'
# 因为实在Windows上开发,所以默认的coffee,lessc不能使用,需要手动更改
PIPELINE_COFFEE_SCRIPT_BINARY = 'coffee'
PIPELINE_COFFEE_SCRIPT_ARGUMENTS = '--bare'
PIPELINE_LESS_BINARY = 'lessc'
PIPELINE_LESS_ARGUMENTS = '-x'
# 还没有想好如何配置yui-compressor压缩
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
# PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
# PIPELINE_CSS_COMPRESSOR = None
# JS压缩貌似有问题,会报错在windows:CompressorError: The system cannot find the path specified.
PIPELINE_JS_COMPRESSOR = None
# 配置编译器,参数在上面
PIPELINE_COMPILERS = (
'pipeline.compilers.less.LessCompiler',
'pipeline.compilers.coffee.CoffeeScriptCompiler',
)
[sqlserver2]
host = 10.18.50.98
instance = sqlserver2008
tds version = 7.0
# mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream django {
server unix:///home/icecream/code/WEBAPP/NodeSite/mysite.sock; # for a file
socket
#server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name 10.18.50.98; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /home/icecream/code/WEBAPP/NodeSite/media; # your Django project'
s media files - amend as required
}
location /static {
alias /home/icecream/code/WEBAPP/NodeSite/static; # your Django project'
s static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/icecream/code/WEBAPP/NodeSite/uwsgi_params; # the uwsg
i_params file you installed
}
}
[sqlserverdatasource]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = Yes
Servername = sqlserver2
Database = mushroom
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Threading = 1
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1
# odbcinst -j
# mysite_uwsgi.ini file
# uwsgi --ini uswgi.ini
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /home/icecream/code/WEBAPP/NodeSite/NodeSite
# Django's wsgi file
module = wsgi:application
env = DJANGO_SETTINGS_MODULE = NodeSite.settings # set an environment variable
# the virtualenv (full path)
home = /home/icecream/mushroom
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = /home/icecream/code/WEBAPP/NodeSite/mysite.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
# clear environment on exit
vacuum = true
pidfile = /tmp/project-master.pid # create a pidfile
harakiri = 20 # respawn processes taking more than 20 seconds
limit-as = 128 # limit the project to 128 MB
max-requests = 5000 # respawn processes after serving 5000 requests
# daemonize = /var/log/uwsgi/yourproject.log # background the process & log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment