当前位置: 首页 > news >正文

台州响应式建站个人备案用作资讯网站

台州响应式建站,个人备案用作资讯网站,WordPress小工具是什么,顺义网站建设推广优化seo首先要说明这段python代码并不完整,而且我也没有做过测试,只是我在工作时参考了其中的一些个方法。这是我在找python相关源码资料里看到的一段代码,是Django静态文件URL配置代码片段2,代码中有些方法还是挺技巧的,做其…

首先要说明这段python代码并不完整,而且我也没有做过测试,只是我在工作时参考了其中的一些个方法。这是我在找python相关源码资料里看到的一段代码,是Django静态文件URL配置代码片段2,代码中有些方法还是挺技巧的,做其它操作时可以参考着使用。需要完整代码的伙伴们可以自已去找找看,如果有时间等,就等我把其它片段收集整理后再贴上来分享。

#!usr/bin/env python
#coding: utf-8import logging
import os.pathDEBUG = True
TEMPLATE_DEBUG = DEBUG
HERE = os.path.dirname(os.path.abspath(__file__))ADMINS = (# ('Your Name', 'your_email@example.com'),
)MANAGERS = ADMINSDATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.'NAME': 'djangodemo',                      # Or path to database file if using sqlite3.'USER': 'root',                      # Not used with sqlite3.'PASSWORD': '',                  # Not used with sqlite3.'HOST': 'localhost',                      # Set to empty string for localhost. Not used with sqlite3.'PORT': '3306',                      # Set to empty string for default. Not used with sqlite3.}
}# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Asia/Shanghai'# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'zh-cn'SITE_ID = 1# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = TrueMEDIA_ROOT = os.path.join(HERE, 'data').replace('\\','/')STATIC_ROOT = os.path.join(HERE, 'static').replace('\\','/')CAPTCHA_FONT=os.path.join(HERE,'static/Vera.ttf')# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
#MEDIA_ROOT = ''# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
#STATIC_ROOT = ''# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'# Additional locations of static files
STATICFILES_DIRS = (# Put strings here, like "/home/html/static" or "C:/www/django/static".# Always use forward slashes, even on Windows.# Don't forget to use absolute paths, not relative paths.
)# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = ('django.contrib.staticfiles.finders.FileSystemFinder','django.contrib.staticfiles.finders.AppDirectoriesFinder',
#   'django.contrib.staticfiles.finders.DefaultStorageFinder',
)# Make this unique, and don't share it with anybody.
#www.iplaypy.com
SECRET_KEY = '3d5&166r)l@xd4zc-a$iuw3nkyi99ee4!k3bjhy)ly1i8pc*b9'
#UPLOAD SETTINGS
FILE_UPLOAD_TEMP_DIR = os.path.join(HERE, 'data/upload/').replace('\\', '/')
FILE_UPLOAD_HANDLERS = ("django.core.files.uploadhandler.MemoryFileUploadHandler","django.core.files.uploadhandler.TemporaryFileUploadHandler",)
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
# for user upload
ALLOW_FILE_TYPES = ('.jpg', '.jpeg', '.gif', '.bmp', '.png', '.tiff')
# unit byte
ALLOW_MAX_FILE_SIZE = 1024 * 1024
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader','django.template.loaders.app_directories.Loader','django.template.loaders.eggs.Loader',
)MIDDLEWARE_CLASSES = ('django.middleware.common.CommonMiddleware','django.contrib.sessions.middleware.SessionMiddleware','django.middleware.csrf.CsrfViewMiddleware','django.contrib.auth.middleware.AuthenticationMiddleware','django.contrib.messages.middleware.MessageMiddleware',
)ROOT_URLCONF = 'urls'TEMPLATE_DIRS = (os.path.join(HERE,'templates'),
)TEMPLATE_CONTEXT_PROCESSORS = (  "django.core.context_processors.auth", "d
2000
jango.core.context_processors.request","django.core.context_processors.media", 
) 
INSTALLED_APPS = ('django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.sites','django.contrib.messages','django.contrib.staticfiles',# Uncomment the next line to enable the admin:'django.contrib.admin',# Uncomment the next line to enable admin documentation:'django.contrib.admindocs','blog','account','news','photo','rbac',
)# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {'version': 1,'disable_existing_loggers': False,'handlers': {'mail_admins': {'level': 'ERROR','class': 'django.utils.log.AdminEmailHandler'}},'loggers': {'django.request': {'handlers': ['mail_admins'],'level': 'ERROR','propagate': True,},}
}
#mail
EMAIL_HOST = 'smtp.gmail.com'                   #邮件smtp服务器
EMAIL_PORT = '25'                                        #端口
EMAIL_HOST_USER = 'code***@gmail.com'  #邮件账户
EMAIL_HOST_PASSWORD = '*********'      #密码
EMAIL_USE_TLS = False

Python代码片段之Django静态文件URL的配置:

#!usr/bin/env python
#coding: utf-8
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()urlpatterns = patterns('',# Examples:# url(r'^$', 'djangodemo.views.home', name='home'),# url(r'^djangodemo/', include('djangodemo.foo.urls')),# Uncomment the admin/doc line below to enable admin documentation:# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),# Uncomment the next line to enable the admin:url(r'^$', 'account.views.index',name="index"),url(r'^admin/', include(admin.site.urls)),url(r'^blog/', include('blog.urls')),url(r'^account/', include('account.urls')),url(r'^news/', include('news.urls')),url(r'^photo/', include('photo.urls')),url(r'^rbac/', include('rbac.urls')),url(r'^static/(?P<path>.*)$','django.views.static.serve',{'document_root':settings.STATIC_ROOT}),url(r'^media/(?P<path>.*)$','django.views.static.serve',{'document_root': settings.FILE_UPLOAD_TEMP_DIR}),
)

http://www.yayakq.cn/news/210216/

相关文章:

  • 百色做网站软件园
  • 网站无法排版河北住房和城乡建设局网站
  • 网站被降权会发生什么影响苏州建筑设计公司排名
  • 如何购买建设网站系统沧州市
  • 中国建设银行官网站周波乐平网站
  • 地方生活门户网站建设方案wordpress 缓存 收录
  • 网站代理浏览器0太原网站制作多少钱
  • 哪个网站做海南二手房公司网站seo外包
  • 樟木头镇仿做网站山东兴华建设集团有限公司网站
  • 北京网站建设公司完美湖南岚鸿首 选网站开发赚钱么
  • html网站的设计哪些网站是用twcms做的
  • 哪个网站建站好wordpress用户注册文件
  • 企业网站栏目规划的重要性南宁响应式网站制作
  • 建设银行 网站用户拼多多网络营销模式
  • 杭州网站网站建设需要汇报哪些内容
  • 高端网站开发的公司深圳百度快速排名提升
  • 开平网站设计百度趋势搜索大数据
  • 烟台公司网站建设网站商城运营模式
  • 许昌市网站开发网站开发需要申请专利吗
  • 一对一直播网站开发厦门软件园网站开发
  • 长春火车站停车场24小时收费标准施工企业突发环境事件应急预案
  • 做网站图片显示不来企业网站主页模版
  • 网站的数据备份和恢复app推广营销公司
  • 网站制作 信科网络宿州做网站公司
  • 东莞网站建设品牌公司网站重新解析
  • 韩版做哪个网站好医疗网站的建设主要竞争对手
  • 网站开发项目项目运营网站带薪歌手都要怎样做呀
  • 丰都网站建设公司毕设 网站开发的必要性
  • 郑州做网站七彩科技邯郸做网站哪家好
  • 免费ps软件网站国内十大4a广告公司