小编use*_*776的帖子

如何在symfony2中禁用数据库配置

我正在开发的新应用程序正在使用Symfony2.没有数据库连接可供使用.相反,它建立在许多Web服务调用之上.在Symfony/app/config下,我想删除所有的database_*条目,但是当我这样做时,我得到一个

ParameterNotFoundException: You have requested a non-existent parameter "database_driver"
Run Code Online (Sandbox Code Playgroud)

错误很明显.但是,如何从应用程序本身解耦和删除数据库配置?

php symfony

9
推荐指数
1
解决办法
4486
查看次数

Tomcat/Spring集成返回404

在Spring 3.1 MVC应用程序上遇到与HTTP Status 404类似的问题

但我没有像海报那样犯同样的错误,但我仍然得到404.

web.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee     http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<display-name>Test</display-name>

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
Run Code Online (Sandbox Code Playgroud)

我能够加载index.jsp但不能加载实际的控制器.

dispatcher-servlet.xml文件:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" 
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">

<!-- enable Spring’s component scanning -->
<context:component-scan base-package="com.test" />

<!-- process the @RequestMapping annotations at the class level -->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />

<!-- process the @RequestMapping annotations at the method level --> …
Run Code Online (Sandbox Code Playgroud)

java eclipse spring tomcat spring-mvc

4
推荐指数
1
解决办法
8736
查看次数

无法使用经典映射找到在映射器上配置的绑定

我正在尝试从mysql加载User对象,但我一直收到UnboundExecutionError:无法找到在mapper Mapper | UserDo | user,SQL表达式或此Session上配置的绑定.我正在使用经典映射.

Base = declarative_base()

# A default constructor is created if one is not already present,
# which accepts keyword arguments of the same name as that of the mapped attributes.

class UserDo(Base):
    __tablename__ = 'user'

    id = Column(Integer, primary_key = True)
    fname = Column(String(100))
    lname = Column(String(100))
    email = Column(String(200))
    salt = Column(String(100))
    created_on = Column(TIMESTAMP) # from sqlalchemy.dialects.mysql import TIMESTAMP

class BaseService(object):

    def __init__(self):
        self._engine = create_engine('mysql://root@localhost/my_db', pool_recycle = 3600)
        self._Session = sessionmaker(bind …
Run Code Online (Sandbox Code Playgroud)

python sqlalchemy bottle python-2.7

4
推荐指数
1
解决办法
6569
查看次数

Bottle app不会处理放入包中单独模块的路径

我有这个目录结构:

.
??? controller
?   ??? FooController.py
?   ??? __init__.py
?
??? main.py
Run Code Online (Sandbox Code Playgroud)

FooController:

from bottle import get, post, request, response, run, abort, \
                   redirect, LocalResponse
import json

@get('/')
def create():
    response.content_type = 'application/json'
    return json.dumps({'hello2' : 'world'})
Run Code Online (Sandbox Code Playgroud)

我执行python main.py,其中包含:

from controller import *
from bottle import get, post, request, response, run, abort, \
                   redirect, LocalResponse

if __name__ == '__main__':
    run(host = 'localhost', port = 8080)
Run Code Online (Sandbox Code Playgroud)

我希望通过导入所有控制器(在这种情况下FooController),它将挂钩到框架.但是当我去localhost时它不会:8080 /我收到404错误.如果我将所有路线都放入main.py,它就可以了.

有谁知道我怎么能完成我正在寻找的东西?

python bottle

2
推荐指数
1
解决办法
1186
查看次数

标签 统计

bottle ×2

python ×2

eclipse ×1

java ×1

php ×1

python-2.7 ×1

spring ×1

spring-mvc ×1

sqlalchemy ×1

symfony ×1

tomcat ×1