我正在使用django 1.8并且遇到麻烦.我想在我的项目中导入tinymce.当我抓住它时
AttributeError:元组'对象没有属性'正则表达式'
当我删除url.py中的url时它正在工作.这是我的代码.
url.py
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
# Examples:
# url(r'^$', 'hizlinot.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
(r'^tinymce/', include('tinymce.urls')),
]
Run Code Online (Sandbox Code Playgroud)
settings.py
"""
Django settings for hizlinot project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR …Run Code Online (Sandbox Code Playgroud) 通过发生反应应用程序编写ES6所以import和export语句的应用程序中使用。所以 Jest 被配置为与 ES6 兼容,但是编译的node_modules依赖项导致了一个错误,即
类型错误:require(...) 不是函数
测试开始时。
我认为这是因为 Jest 配置为与 babel-jest 一起处理import语句,但编译代码require用于处理模块。我试图排除node_modules文件夹,但没有任何改变。我认为,ES6 模块使用放置在 node_modules 中的编译模块作为依赖项,因为它不能被排除在外?是否可以?
另外,我有一个问题,了解如何做的玩笑同时处理import,并require在同一时间?如果先编译 ES6 代码,那么每个模块将require在编译过程之后处理。那么问题是什么?
这是配置
开玩笑的配置文件
module.exports = {
clearMocks: true,
moduleNameMapper: {
"^.+\\.(js|jsx)$": "babel-jest",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/mocks/fileMock.js",
"\\.(css|scss|sass|less)$":
"<rootDir>/mocks/styleMock.js"
},
modulePathIgnorePatterns: [
"node_modules/"
]
};
Run Code Online (Sandbox Code Playgroud)
babel.config.js
/* eslint-disable */
module.exports = {
presets: [
"@babel/preset-react",
[
"@babel/preset-env",
{
targets: {
browsers: ["ie >= 9", "safari …Run Code Online (Sandbox Code Playgroud) 我们有一个纯组件,我们正在尝试将其转换为Flow类型的安全性。应用程序将此组件用作HOC(高阶组件)。它正在生成上下文并将其注入已调度的组件。
因此,HOC的一种方法是返回涉及许多绑定操作的对象文字。在这些键值对中,有一个我们未处理的表达式。
我们收到有关缺少符号的错误:
T的类型注释缺失。T是在数组类型 [1]中声明的类型参数, 并在调用方法filter [2] 时隐式实例化。
export type PropsType = {
reviewConf ? : Object,
...
}
export type ContextType = {
registerComponent: () => void,
errors ? : Array < any >
...
}
export type StateType = {
meta: Object
}
class AbstractPureFormComponent extends React.PureComponent < PropsType, StateType > {
constructor(props: PropsType, context: ContextType) {
super(props, context)
this.state = {
meta: {}
}
}
getChildContext() {
return {
registerComponent: this.registerComponent.bind(this),
...
errors: Object.keys(this.state.meta).filter(
name …Run Code Online (Sandbox Code Playgroud) 我们有一个基于 fetchBaseQuery 的基本 RTK API Slice,就像RTK 文档中推荐的那样。
此外,还有一个后端服务将数据作为响应中的文本返回,但声明为Content-Type: application/json响应标头。我知道这不是一致的,但不幸的是,我们现在无权更改这一点。
我们尝试以正确的方式解析它,但我们无法获得任何有关数据的线索,我们在 RTK 中没有看到,甚至无法到达transformResponse. 当我们检查网络选项卡上的 XHR/Fetch 活动时,我们看到了预期的响应,这是我们成功接收数据的唯一线索。
我认为 RTK 不会处理此数据,因为它在响应标头上声明为 json,但在正文内以文本、字符串形式提供。这有点尴尬,因为我们在任何地方都没有看到任何错误。
您知道我们如何才能在 RTK 内部获得响应吗?
javascript ×2
reactjs ×2
django ×1
django-1.8 ×1
django-urls ×1
ecmascript-6 ×1
flowtype ×1
jestjs ×1
livereload ×1
module ×1
python-2.7 ×1
redux ×1
regex ×1
rtk-query ×1
webpack ×1