Giter VIP home page Giter VIP logo

django-simditor's Issues

Language

How Can I change the Language for the module

Nginx部署上线之后,与imagefiled好像冲突,图片上传失败

类里面:
class Post(models.Model):

title = models.CharField(max_length=70,verbose_name='文章')
image = models.ImageField(upload_to='uploads', verbose_name='图片')
body = RichTextField(verbose_name='正文')

setting里面:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR,'media')

SIMDITOR_UPLOAD_PATH = 'uploads/'
SIMDITOR_IMAGE_BACKEND = 'pillow'

Nginx事件里面:
location /static {
alias /home/ubuntu/sites/downdawn.com/myblog2/static;
}
location /media {
alias /home/ubuntu/sites/downdawn.com/myblog2/media;

观看源码时的疑惑

"simditor/views.py"

def upload_handler(request):
    files = request.FILES

    upload_config = settings.SIMDITOR_CONFIGS.get(
        'upload', {'fileKey': 'upload'})

    filekey = upload_config.get('fileKey', 'upload')

    uploaded_file = files.get(filekey, 'upload')

    backend = image_processing.get_backend()

    if not getattr(settings, 'SIMDITOR_ALLOW_NONIMAGE_FILES', True):
        try:
            backend.image_verify(uploaded_file)
        except utils.NotAnImageException:
            retdata = {'file_path': '', 'success': False,
                       'msg': '图片格式错误!'}
            return JsonResponse(retdata)

    filename = get_upload_filename(uploaded_file.name)

    saved_path = default_storage.save(filename, uploaded_file)

    url = utils.get_media_url(saved_path)

    is_api = settings.SIMDITOR_CONFIGS.get('is_api', False)
    url = request.META.get('HTTP_ORIGIN') + url if is_api else url

    retdata = {'file_path': url, 'success': True, 'msg': '上传成功!'}

    return JsonResponse(retdata)

从源码的第38与第50行中,即上述代码的uploaded_file = files.get(filekey, 'upload')filename = get_upload_filename(uploaded_file.name) 中可以看出
uploaded_file 是一个字符串,应该不具有 name 属性吧?

图片上传

请问可以在不改动源码的情况下添加自定义的图片名修改和图片压缩代码吗?

编码问题没人遇到过么?

`Traceback (most recent call last):
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python2.7.12/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/vagrant/dev/projects/supermarket/supermarket/urls.py", line 32, in
url(r'^simditor/', include('simditor.urls')),
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/django/conf/urls/init.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/local/python2.7.12/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/simditor/urls.py", line 10, in
from . import views
File "/home/vagrant/.supermarket/lib/python2.7/site-packages/simditor/views.py", line 42

SyntaxError: Non-ASCII character '\xe5' in file /home/vagrant/.supermarket/lib/python2.7/site-packages/simditor/views.py on line 42, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details`

views.py文件中用了中文,但没申明编码方式,大家的都不报错么?

前端不显示代码框

settings

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')


SIMDITOR_UPLOAD_PATH = 'uploads/'
SIMDITOR_IMAGE_BACKEND = 'pillow'


SIMDITOR_TOOLBAR = [
    'title', 'bold', 'italic', 'underline', 'strikethrough', 'fontScale',
    'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link',
    'image', 'hr', '|', 'indent', 'outdent', 'alignment', 'fullscreen',
    'markdown', 'emoji'
]

SIMDITOR_CONFIGS = {
    'toolbar': SIMDITOR_TOOLBAR,
    'upload': {
        'url': '/simditor/upload/',
        'fileKey': 'upload'
    },
    'emoji': {
        'imagePath': '/static/simditor/images/emoji/'
    }
}

models

from django.db import models
from simditor.fields import RichTextField

# Create your models here.


class Post(models.Model):
    title = models.CharField(verbose_name='标题', max_length=50)
    content = RichTextField(verbose_name='内容')

    class Meta:
        verbose_name = '文章'
        verbose_name_plural = verbose_name

views

from django.shortcuts import render

# Create your views here.

from .models import Post

def post(request):
    post = Post.objects.all()[0]
    return render(request, 'index.html', {'post': post})

html 里加了 safe 过滤器
检查元素查看 html 代码为

<pre><code class="lang-c++">class Few():
&nbsp;&nbsp;a = 0;
&nbsp;&nbsp;b= 0
</code></pre>

但是没有那个灰色的代码框

在centos6下安装, Python3.6 报错

Collecting django-mdeditor Using cached https://files.pythonhosted.org/packages/e2/19/7623e00aa1eafc4c68ecff13a03505cfee003b9e8bd2350e8c6f28cc52d1/django-mdeditor-0.1.4.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-qbbpxwl5/django-mdeditor/setup.py", line 5, in <module> README = readme.read() File "/root/.virtualenvs/blogWithDjango2/lib/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 3255: ordinal not in range(128)

下拉页面的时候,向上浮动,

您好!我在使用时,遇到了这样的问题请问该如何解决呢
image
一下拉就会变成这样
image

怎么去除浮动效果呢,我在setting里写了也没什么用

严重bug?

怎么重新编辑清空以前所有内容?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.