publish

django模型层 、 ORM查询

一个人想着一个人 提交于 2020-01-09 00:55:33
模型层 ORM查询 单表查询 前期准备工作需求: 如何只单独测试django中的某一个py文件 如何书写测试脚本 如何使用: 在任意一个py文件中书写以下代码 应用下的tests 或者自己新建一个 import os if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "day53.settings") import django django.setup() 前期准备工作图片分析: 第一步:先到 settings.py配置信息: 第二步:modles 中设置数据信息 auto_now:每次修改数据的时候 都会自动将最新的更新时间记录下来auto_now_add:只在创建数据的时候将创建时间自动记录下来 之后不会自动改变 第三步: 从mange中获取四句信息,复制到相应的文件中(tests中 看你自己)在进行导入相关文件(不到入回报错) 必知必会16条 """ 必知必会16条 1.create() 2.all() 3.filter() 4.update() 5.delete() 6.first() 7.last() 8.get() 9.values() 10.values_list() 11.order_by() 12.count() 13.exclude() 14.exists()

单表查询,多表查询,分组查询,聚合函数,F与Q

白昼怎懂夜的黑 提交于 2020-01-09 00:03:32
一、单表查询前期准备 1、新建数据库修改django默认配置数据库 去django项目下的settings修改数据库参数 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'day53', # 写你自己的数据库 'USER': 'root', 'PASSWORD': '123456', # 写你自己的密码 'HOST': '127.0.0.1', 'POST': 3306, 'CHARSET': 'utf8' } } 2、去项目app应用下或者与项目同名同名文件下的__init__文件下修改数据库 import pymysql pymysql.install_as_MySQLdb() 3、创建数据 from django.db import models # Create your models here. class Movie(models.Model): title = models.CharField(max_length=64) price = models.DecimalField(max_digits=8, decimal_places=2) publish_time = models.DateField() # 年月日 # publish_time = models

Django(数据查询)

百般思念 提交于 2020-01-08 20:44:09
如何治单独测试django中的某一个py文件 书写测试脚本:   - 在应用下的tests.py或者自己建一个py文件   - 在文件中书写以下内容: if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "day53.settings") import django django.setup() 创建表格: class Movie(models.Model): title = models.CharField(max_length=64) price = models.DecimalField(max_digits=8,decimal_places=2) publish_time = models.DateField() # 年月日 create() :创建数据,返回值就是当前被创建数据的对象本身 models.Movie.objects.create(title='齐天大圣',price=999.23,publish_time='2016-1-1') all() :查询所有数据,返回的是queryset对象 res = models.Movie.objects.all() fileter() :按照一定条件查询,条件可以是多个,条件直接关系是and,返回的是queryset对象

Transforming crossdomain.xml on publish in asp.net web application

大憨熊 提交于 2020-01-06 14:26:32
问题 I'm attempting to transform crossdomain.xml for different environments, just like regular web.config files. I've tried using SlowCheetah add-in for visual studio, but it doesn't play well with web applications. It kept publishing transform files along with the transformed file, which i didn't want. Moreover, it did that for web.config transformation as well. My other thought was to rename the file and all transforms to crossdomain.$(Configuration).config in hopes that VS would pick it up and

why pusher works on localhost but not on a live website

こ雲淡風輕ζ 提交于 2020-01-06 04:05:14
问题 I've used Pusher API to put a simple push notification in place. I've tested everything and Pusher works on my localhost . When I put the same code on a live website, Pusher doesn't publish my message. That's interesting to note that if I push from localhost I can see the message on the live version. It seems that I have no problem subscribing to a channel, but the problem is that I cannot publish a message on the channel. This is my code: // Create pusher event $pusher=Yii::app()->pusher;

Good way to develop Open Source without exposing credentials?

旧城冷巷雨未停 提交于 2020-01-05 08:42:43
问题 I develop a web application and push its source code to a public Github repository. The issue is that the PHP code contains database credentials which shouldn't be visible to other people. Now I'm looking for a good way to handle this. I could exclude the configuration file from the Git repository using .gitignore , but then others wouldn't see the structure to create their own configuration. On the other hand, I don't want to manually replace the real credentials for every commit. What is a

GWT project external mode Main/Main.nocache.js not found

送分小仙女□ 提交于 2020-01-04 12:48:31
问题 i'm working with GWT and runnin on apache tomcat 7.0.16, when today i tried to start application and i got an error when browser opened. in browser console 404 Main/Main.nocache.js. what can i fix it. when i looked at org.eclipse.wsr.server.core/temp0/wtpwebapps directory cant see Main directory and their content such as nocache.js and other static content. and i checked eclipse war directory Main directory is exist. i think some configurations has changed and tomcat cant publish. my gwt

Issue with TFS build definition and WCF service in a Web Site “Project”

流过昼夜 提交于 2020-01-03 05:49:06
问题 I'm trying to create a TFS build definition for a WCF service I'm working on. When I go to set the "Items to Build\Projects to Build," I can't choose any .*proj or .sln file. The source for the service is under the "Visual Studio\WebSites\SERVICE_NAME" directory which does not have a .proj or .sln file. I've been looking around for any material on the matter and nothing seems to be relevant to my situation. 回答1: You have chosen to use a Web Site "project". That was a mistake. Web sites are

Publish MVC v1 C# application through Cruise Control

不问归期 提交于 2020-01-02 18:18:08
问题 I am attempting to publish a 3.5 MVC website on my build server through cruise control. Having looked around on the net it appears you need to wrap the ASP Net Compiler. I was hoping that this task can be called through MSBuild. Any ideas on how this is done? 回答1: This is fairly simple to accomplish with an MSBUILD file. Here's a sample target the will rebuild your entire solution and will deploy your MVC web application to your desired output directory <Target Name="Deploy"> <MSBuild

DefineCustomFiles and CustomCollectFiles are not fired by TeamCity

流过昼夜 提交于 2020-01-01 17:28:52
问题 I'm trying to publish extra files with TeamCity. I also opened a subject here: Publish extra dll files not included in the web project but here I'm focused on the fact that DefineCustomFiles and CustomCollectFiles seem not fired. My build step looks like this: And my custom build file looks like this : <?xml version="1.0" encoding="utf-8"?> <!-- This file is used by the publish/package process of your Web project. You can customize the behavior of this process by editing this MSBuild file. In