publish

Eclipse: Difference between clean, build and publish

半世苍凉 提交于 2019-12-02 14:39:06
I am using eclipse with tomcat. On the server ( right-click )tab you have the options: Clean, Publish and Clean Tomcat Work directory, What do these options really do and how are they different from project > Build When you run "project > Build" , eclipse will compile all sources in folders on the build path to the .class files and put the .class files into the output folder you specified. Both of these folders can be configured from Project-> Properties-> Java Build Path . Note that eclipse has the incremental build feature that will only compile the sources that have changed since the last

Django ORM-objects-QuerySet

时间秒杀一切 提交于 2019-12-02 11:44:16
Django ORM res1=models.Book.objects.get(title='步天歌') 不知道你有没有发现,objects和Queryset方法有很多是一样的,Queryset有的方法objects都会有,而且他们还有一个相似的地方,设置方法是返回值都是一样,都是返回Queryset对象 查看objects源码 发现底层是c实现的,看不了,但是这里出现了熟悉的东西,它继承的类中有个QUerySet class Manager(BaseManager.from_queryset(QuerySet)): pass 查看from_queryset源码,看它到底干了啥 @classmethod def from_queryset(cls, queryset_class, class_name=None): #class为空执行if内的内容 if class_name is None: #这里拼接了字符串 class_name = '%sFrom%s' % (cls.__name__, queryset_class.__name__) class_dict = { '_queryset_class': queryset_class, } #这一步很可疑,到底向这个字典里放了什么,看下一段代码,使用了BaseManager._get_queryset_methods();

多表关系和查询

空扰寡人 提交于 2019-12-02 11:32:32
多表关系 社会中存储需要可以构建成表的数据, 它们形成的表,往往之间存储某种或某些社会关系, mysql数据库建立表结构就是社会中产生的各种数据, 分门别类管理 但mysql建立的(代码层次的)表之间, 同样需要处理表与表之间的关系 形成了 多对一 | 多对多 | 一对一 三种关系 """ 一对一:丈夫-妻子,用户-身份证,作者-作者详情 一对多:部门-员工,班级-学生,书-出版社 多对多:老师-班级,课程-学生,出版社-作者 """ # 书 - 出版社 - 作者 - 作者详情 外键分布 # 外键是 建立表与表关联 的字段,通常 一个表的外键 是 另一个表的主键(唯一键也可以) # 一对一:外键在任何一方都可以,此时外键要设置 唯一键 """ 作者(author):id,name,sex,age,mobile 作者详情(author_detail): id,info,address,author_id ---------------------------------------------------- 作者(author):id,name,sex,age,mobile, detail_id 1 Tom 1 2 Bom 2 3 Bob 3 作者详情(author_detail): id,info,address 1 Tom_info 2 Bom_info """ # 一对多

Running Target after files are published to FileSystem

寵の児 提交于 2019-12-02 10:46:42
问题 I am trying to create publish profile which would copy all published files to various folders. Unfortunately I read that's not possible to do it directly through publishUrl and it's advised to publish to one folder from which to copy all the files. I managed to write the copy target functionality, but the order of when targets are run is wrong. I'm trying to run the publish directly from VisualStudio 2015, through Build > Publish Web. Here is my publish profile: <Project ToolsVersion="4.0"

SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified for MDF file

那年仲夏 提交于 2019-12-02 09:54:38
问题 I have added a database file ( .mdf ) to my application using Visual Studio built-in functionality. Database is in the App_Data folder. It is running fine. But when I publish it and upload it to server it gives this error. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL

Swingworker with FileVisitor class and walkFileTree(), which iterates internally over a “set” of files in a directory tree; where to publish()?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 08:37:34
It seems like the long-running tree walker task should be defined in a class like so: public class TreeWalker extends SwingWorker<Void,String> implements FileVisitor<Path> And begun somewhere like so: TreeWalker walker = (new TreeWalker()); walker.execute(); The long-running task is not only initiated by but completely carried out by a single call to walkFileTree() , a method in the Files class. So surely the call to it has to be in doInBackGround() . protected Void doInBackground() throws Exception { Files.walkFileTree(SearchyGUI.p , this); return null; } Note that walkTreeFile() internally

08 Django 多表操作

半城伤御伤魂 提交于 2019-12-02 07:06:12
目录 一、数据库表关系 二、图书馆里系统案例 2.1 找关系 2.2 django中ORM创建模型表 2.3 注意 三、添加、删除、修改记录 3.1 添加记录 3.2 删除、修改数据 四、查询记录 五、基于对象的查询 5.1 跨两张表查询 1.一对一查询(模型类Author与AuthorDetail) 2.一对多查询(模型类Publish和Book) 3.多对多查询(模型类Book与Author) 5.2 连续跨>2张表查询 六、基于下划线的跨表查询 6.1 跨两张表查询 1.一对一查询(模型类Author与AuthorDetail) 2. 一对多查询(模型类Book与Publish) 3 多对多查询(模型类Book与Author) 6.2 连续跨>2张表查询 一、数据库表关系 在讲解MySQL时,我们提到,把应用程序的所有数据都放在一张表里是极不合理的。 比如我们开发一个员工管理系统,在数据库里只创建一张员工信息表,该表有四 个字段:工号、姓名、部门名、部门职能描述,此时若公司有1万名员工,但只有 3个部门,因为每一名员工后都需要跟着部门信息(部门名、部门职能),所以将 会导致部门信息出现大量重复、浪费空间。 解决方法: 是将数据存放于不同的表中,然后基于foreign key建立表之间的关联 关系。 表关系有三种: 一对一、一对多、多对多 ###################

Django基础之模型层(models.py)、ORM查询之单表查询、多表查询和跨表查询

倾然丶 夕夏残阳落幕 提交于 2019-12-02 07:02:15
目录 Django基础之模型层(models.py)、ORM查询之单表查询、多表查询和跨表查询 ORM查询 django测试环境搭建 单表查询 应知应会13条方法 神奇的双下划线查询 多表查询 外键字段的增删改查 ORM跨表查询 正反向的概念 基于对象的跨表查询-----子查询 基于双下划线的跨表查询-----连表查询 Django基础之模型层(models.py)、ORM查询之单表查询、多表查询和跨表查询 ORM查询 如果想查看orm语句内部真正的sql语句,有两种方式: 1.如果是queryset对象 那么可以点query直接查看该queryset的内部sql语句 2.在django项目的配置文件中 配置一下参数即可实现所有的orm在查询的时候自动打印对应的sql语句,把下面的代码加到settings配置文件中即可 LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', }, }, 'loggers': { 'django.db.backends': { 'handlers': ['console'], 'propagate': True, 'level':

Django框架之模型层 多表操作

て烟熏妆下的殇ゞ 提交于 2019-12-02 07:00:55
目录 一、多表关系 二、多表操作 2.1 分析多表关系 2.2 创建表 2.3 外键字段的增删改查 2.4 多对多字段的四个方法 三、跨表查询 3.1 子查询 3.2 连表查询 一、多表关系 回顾一下设置外键的sql语句: foreign key(外键字段) references 关联表(关联字段) 设置级联关系: on update cascade # 更新级联关系,要改一起改 on delete cascade # 删除历练关系,要死一起死 一对一 外键在任何一方都可以,但是尽量放在使用的次数多的一方,并设置字段唯一键, 一对多 外键放在多的一方,此时外键不唯一 多对多 一定要创建第三张表(关系表),每一个外键值不唯一,但可以多个外键建立联合唯一 二、多表操作 首先多表操作,应该在建表之前,就先设计好多表关系,然后再去创建表。 2.1 分析多表关系 需求:现在需要写一个图书管理的程序,需要设计表。如何设计 图书表 图书表包括(书名、价格、出版日期) 出版社表 出版社表包括(出版社名、地址) 作者简介表 作者简介表包括(作者名、年龄) 作者详情表 作者详情表包括(电话、地址) 一对一: 一个作者简介唯一对应作者详情表,一个作者详情也唯一对应作者简介 一对多: 一个图书对应唯一对应一个出版社,一个出版社可以对应多本书 多对多: 一个图书对应多个作者,一个作者也同样对应多本书 2.2

django之模型层(待补充)

*爱你&永不变心* 提交于 2019-12-02 06:58:31
模型层 1. ORM查询 所有代码都是在 test.py 文件中运行的 注意:我如果想在 test.py 文件中测试相关代码,那么必须要进行配置,不然会报以下的错误 django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. 意思就是, django 本身是一个搭好的框架,你不能单独运行某一个文件,它是一个整体,运行文件前必须要进行环境配置 所以我们的思路就是在 test.py 文件中,让它一启动改文件,就把相关的环境配置好,于是就加了下面几句 if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "one_search.settings") import django django.setup() ## 这几句话的意思就是,启动该文件时