Ckeditor remains hidden after creation - editor.css is empty - python

I am trying to use ckeditor in a web project I am currently developing.
The problem is that when I try to instantiate the Ckeditor (either via the jQuery adapter or with the CKEDITOR.replace command), the editor is created but it is hidden.
I inspected the source code and for some reason it has this css attribute
.cke_skin_kama {
visibility: hidden;
}
Then I checked the css files that it uses and I noticed that the editor.css file has no css rule in it! It's completely empty, although it points to the correct url.
Do you know why this is happening? Any hint would be more than welcome!
Thanks in advance!
UPDATE: I tried to use Tinymce also, but I have the same problem. The file ui.css is empty too.
I am using python-webapp2 for GAE. Could this have any relation to the problem? Any specific configuration I have to do?
Thanks!

The problem probably lies in the declaration of your static files directories. Try to move ckeditor outside the paths of your existing static files. For example add the following in your app.yaml, and of course place the ckeditor in the respective folder:
- url: /ckeditor
 static_dir: static/ckeditor

if you want create chkeditor into your page you can use this code after attaching chkeditor javascript file :
<textarea id='chkeditor2' class='ckeditor' name='editor1'></textarea>
class and name is defined into javascript file and this text area will chkeditor panel. sorry for bad english :) i hope this will helpfull for you :)

Related

Django does not find static on all pages except the main

The project is hosted (support say to solve the problem yourself and therefore my friends hope for your help) and you can find it at: https://caparolcenterspb.ru
All styles, pictures and js appear on the main page, but not on other pages. You can see the errors directly in the browser, but just in case I give a screen:
It seems you are adding the path to the static file not from the STATIC_ROOT, but from the current URL. I'll explain with the example.
On the main page, you got the link:
https://caparolcenterspb.ru/
And looking for the static logo at:
https://caparolcenterspb.ru/static/img/Logo.svg
And all works fine. But if you will go to
https://caparolcenterspb.ru/services/
The URL for the logo request will change to:
https://caparolcenterspb.ru/services/static/img/Logo.svg
Which is wrong and there are obviously no files on this link.
So, the solution to your problem will be fixing STATIC_URL in Django settings. You need to use the same fixed STATIC_ROOT for all static requests and everything will be fine.
It is pretty simple, just check everything is done as it described here:
https://docs.djangoproject.com/en/3.0/howto/static-files/
The shown error explains your MIME is text/html not text/css. It's linked to your browser or OS.
Try to add this in your settings.py:
import mimetypes
mimetypes.add_type("text/css", ".css", True)

Django doesn't show the CSS of my template

The problem is described in title. I have this template for a blog that I'm creating using Django.
When I open it normally, using double click over the HTML file, it looks like this:
But when I open it via url from the Django project, it looks like this
It only shows a green square (part of the css) but obviously can't open the css correctly.
Any idea to solve this?
In Django you don't open the HTML with double click on the file, you need to run the server first and open your site using the localhost (like you did in the second picture).
Judging by those images, are you sure you put the image in the static folder? In Django, the HTML files stays in the "templates" folder of your app and the css, javascript and images in the "static" folder.
If this answer doesn't help you, then you should post your code here, otherwise I can't find the problem.

Including part of html file in web2py

I am a newbie to web2py and want to do this..
I am doing a presentation web application , in which users can view presentations(reveal.js files) of a number of topics. These presentations contain head tags and scripts which are same to all.. so i thought of creating a view called default/presentation.html and then store all the presentations as html/xml files and display them inside the learn.html file (these files contain only part of file, stuff within the body tag). But I have tried a lot of stuff, but still could not get id due to web2py's default escaping feature. Please help me out with the most simplest way.
P.S. This is an awesome community where i took most of my programming lessons. Thanks in advance.
Update: thanks a lot guys. Found a solution finally using xml parsing with etree. In my view,
{{for i in tree: }}
{{=TAG [i.tag] (i.text)}}
{{pass }}
Guess what? Works amazing!
If you just want to insert some HTML into a page without it being escaped, you can use the XML() helper:
{{=XML(your_html)}}
If you want to include the contents of a file, you can do:
{{include 'path/to/file'}}
Note, the path is relative to the application's /views folder, so if it is outside of that folder, you can start the path with ../.

Django Debug Toolbar Only Working for Admin Section

Hey,
I've been using Django 1.2.1 for some time now and came across Django Debug Toolbar just the other day. It looks really useful and I'm really eager to try some stuff out.
I installed exactly how the readme said. Step by Step. I put the middleware at the end just in case things get caught up but I'm using quite standard middleware (common, sessions, auth and csrf). However, it won't show up on any of my pages. I've tried moving the middleware but to the same effect.
It seems as if I've installed something wrong. But, when I load up the Admin Section of django, the toolbar springs up. I'm not sure what I'm doing wrong. Can the content of my pages effect the toolbar coming up? It's outputting in the mime text/html...
Anyway, any help is greatly appreciated. Thanks in advance.
Here's my Settings.py: pastebin.com/Hu8TgANt
Debug toolbar requires that there's at least a closing </body> tag in the response HTML.
This tag can be changed by changing settings.DEBUG_TOOLBAR_CONFIG['INSERT_BEFORE']
http://django-debug-toolbar.readthedocs.org/en/latest/configuration.html#toolbar-options
A few tipps without knowing your code:
'debug_toolbar.middleware.DebugToolbarMiddleware' should be your last or second to last middle ware entry (not 100% sure how it works out with the flatpagefallback middleware)
'debug-toolbar' as last in the list of INSTALLED_APPS
Double check if the toolbar's assets are loaded
Make sure all toolbar settings are set. (DEBUG_TOOLBAR_CONFIG, INTERNAL_IPS) etc.
The error should be something in there. I know of other problems related getting the toolbar displayed on flatpages so if you only checked on flatpages I suggest you try it on another module.
I had the same problem here, and eventually arrived at this post... Anyway, in my case what I noticed was that I had a javascript error in one of my js included libraries. And that breaked the js interpretation flow. When I fixed the javascript error, the django toolbar worked.
That explains why it worked in the admin pages, but not in my app pages.
Missing INTERNAL_IPS key in settings.py impacts toolbar visibility. Adding this resolves the issue:
INTERNAL_IPS = ('127.0.0.1',)
In my case, I was using Google Material Design Lite as the frontend framework,
which has the style definition,
*[hidden]{
display:none!important;
}
this style is applied to Debug Toolbar's elements which result in displaying nothing.
a quick workaround was to change the MDL's style definition (only possible on local stylesheets, not with cdn hosted) to
*[hidden]{
display:none;
}
I had a similar issue. The solution was closing a div as a non-empty HTML element.
From this
<body>
...
<div id="map-canvas"/>
...
</body>
to this
<body>
...
<div id="map-canvas"></div>
...
</body>
Hope it helps!
In my case the error was very simple.
I removed the footer and it worked like a charm!
Hope this solves an issue for somebody else.

Django: Page doesn't load images

I am working on a Django project for a company. This project worked very well before today.
Today I found a page can not show images (and their corrsponding links). I checked source code of THAT PAGE, I found there are images and links, I just can not find them on the page.
I checked the auth of the server and I am sure I can write things to the database. In fact, I think it is not database mistake because I can find what I want in the page source code, I just can not find them on the page.
Oh my Gosh, I am going to be crazy...
Has anyone suffered similar problem? What kind of problem could it be?
Please help me! Thank you very much!
PS: I can not provide any source code of the project because some business limit...I am really sorry...
Try exploring the site_media directory. If you're images are being served up as static content it could be related to the permissions of that folder on local disk or based on the settings.
Within your urls you may have something similar to:
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/path/to/media'}),
OR it may reference the path in the settings file something similar to:
STATIC_DOC_ROOT = '/path/to/media'
If the link looks correct for the image, but the side is not rendering the image even directly your issue will be somewhere in these areas.
For more information check the django docs:
http://docs.djangoproject.com/en/dev/howto/static-files/

Categories