ckeditor does not shown when served from local - python

flask-ckeditor module work from cdn but when I served from local it does not shown, and my ckeditor is a custom build.
├── app.py
├── static
│   ├── ckedit
│   │   ├── build
│   │   │   ├── ckeditor.js
│   │   │   ├── ckeditor.js.map
│   │   │   └── translations
│   │   ├── ckeditor5-32.0.0-ia4y775k4cd6.zip
│   │   ├── LICENSE.md
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── sample
│   │   │   ├── index.html
│   │   │   └── styles.css
│   │   ├── src
│   │   │   └── ckeditor.js
│   │   └── webpack.config.js
│   └── css
│   └── style.css
├── templates
│   └── index.html
└── venv
├── bin
├── lib
└── pyvenv.cfg
flask 2.0.3
flask-CKEditor 0.4.6
* by the way samples are working fine but because of uploader I don't wanna use ckeditor without module

Related

Gunicorn giving me Module Not Found Error

I'm attempting to build a Django blog.
I have a couple of apps in there, but for some reason Gunicorn is giving me trouble with the error - ModuleNotFoundError: No module named 'blog.wsgi'
├── Procfile
├── blog
│   ├── blog
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   ├── __init__.cpython-36.pyc
│   │   │   ├── settings.cpython-36.pyc
│   │   │   ├── urls.cpython-36.pyc
│   │   │   └── wsgi.cpython-36.pyc
│   │   ├── settings.py
│   │   ├── urls.py
│   │   └── wsgi.py
│   ├── db.sqlite3
│   ├── manage.py
│   ├── media
│   │   ├── 1820-3-large.jpg
│   │   ├── 1820-3-large_XGHcfcZ.jpg
│   │   ├── 1820-3-large_ZTmLkYt.jpg
│   │   ├── 1820-3-large_dPbPsPW.jpg
│   │   └── paul-morris-144777.jpg
│   ├── posts
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   ├── __init__.cpython-36.pyc
│   │   │   ├── admin.cpython-36.pyc
│   │   │   ├── models.cpython-36.pyc
│   │   │   └── views.cpython-36.pyc
│   │   ├── admin.py
│   │   ├── apps.py
│   │   ├── migrations
│   │   │   ├── 0001_initial.py
│   │   │   ├── 0002_auto_20171217_0000.py
│   │   │   ├── __init__.py
│   │   │   └── __pycache__
│   │   │   ├── 0001_initial.cpython-36.pyc
│   │   │   ├── 0002_auto_20171217_0000.cpython-36.pyc
│   │   │   └── __init__.cpython-36.pyc
│   │   ├── models.py
│   │   ├── static
│   │   │   └── posts
│   │   │   ├── css
│   │   │   ├── img
│   │   │   │   └── home.jpg
│   │   │   └── js
│   │   ├── templates
│   │   │   └── posts
│   │   │   ├── home.html
│   │   │   └── post_details.html
│   │   ├── tests.py
│   │   └── views.py
│   └── sitepages
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-36.pyc
│   │   ├── admin.cpython-36.pyc
│   │   ├── models.cpython-36.pyc
│   │   └── views.cpython-36.pyc
│   ├── admin.py
│   ├── apps.py
│   ├── migrations
│   │   ├── __init__.py
│   │   └── __pycache__
│   │   └── __init__.cpython-36.pyc
│   ├── models.py
│   ├── static
│   │   └── sitepages
│   │   ├── css
│   │   │   └── about.css
│   │   ├── img
│   │   └── js
│   ├── templates
│   │   └── sitepages
│   │   └── about.html
│   ├── tests.py
│   └── views.py
├── requirements.txt
└── venv
`
This is the bulk of my file tree as I see it. I don't see any issues, but I'm definitely overlooking something. Let me know if you'd like to see any other pieces of code.
My Procfile says -
web: gunicorn blog.wsgi --log-file -
This is my wsgi.py file -
This is wsgi.py -
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "blog.settings")
application = get_wsgi_application()

Django ModuleNotFound For scripts

This has been driving me up the wall. I have a Django project with the following tree structure, and am trying to run python helper_scripts/load_professors_into_db.py from the root directory
load_professors_into_db.py has the following code:
## TODO: FIX THIS DAMN IMPORT PATH. THE SCRIPT DOESNT RUN CAUSE OF IT
from ocubulum_dashboard.models import Researcher
import pandas as pd
df = pd.read_csv("helper_scripts/soc_myaces_list.csv")
df = df.dropna()
df = df[~pd.isnull(df["scopus_id"])]
df = df[df["scopus_id"] != 'None']
However, it keeps trying ModuleNotFound errors. I've tried adding __init__.py files everywhere, but that doesn't work either.
Traceback (most recent call last):
File "helper_scripts/load_professors_into_db.py", line 10, in <module>
from ocubulum_dashboard.models import Researcher
ModuleNotFoundError: No module named 'ocubulum_dashboard'
The problem doesn't only occur for this. For other scripts that I want to run such as scopus_scraper.py, I face this ridiculous import issue as well.
Traceback (most recent call last):
File "data_collectors/scopus/scopus_scraper.py", line 1, in <module>
from ocubulum_dashboard.models import Researcher
ModuleNotFoundError: No module named 'ocubulum_dashboard'
Can someone point me as to how to solve this problem? I'm on python 3.6.
Entire Folder Structure:
├── data_aggregators
│   ├── myaces_aggregator.py
│   └── scopus_aggregator.py
├── data_collectors
│   ├── execute_all.py
│   ├── __init__.py
│   ├── journals
│   │   ├── __init__.py
│   │   ├── journal_scraper.py
│   │   ├── master.py
│   │   ├── __pycache__
│   │   │   └── __init__.cpython-36.pyc
│   │   └── test.json
│   ├── nus_myaces
│   │   ├── __init__.py
│   │   ├── master.py
│   │   └── __pycache__
│   │   └── __init__.cpython-36.pyc
│   ├── __pycache__
│   │   └── __init__.cpython-36.pyc
│   └── scopus
│   ├── __init__.py
│   ├── master.py
│   ├── __pycache__
│   │   └── __init__.cpython-36.pyc
│   ├── scopus_scraper.py
│   └── scopus_wrapper
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-36.pyc
│   │   └── scopus_wrapper.cpython-36.pyc
│   └── scopus_wrapper.py
├── environment.yml
├── helper_scripts
│   ├── __init__.py
│   ├── load_professors_into_db.py
│   ├── __pycache__
│   │   └── __init__.cpython-36.pyc
│   └── soc_myaces_list.csv
├── __init__.py
├── manage.py
├── ocubulum
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-36.pyc
│   │   ├── settings.cpython-36.pyc
│   │   ├── settings_development.cpython-36.pyc
│   │   ├── urls.cpython-36.pyc
│   │   ├── views.cpython-36.pyc
│   │   └── wsgi.cpython-36.pyc
│   ├── settings_development.py
│   ├── settings.py
│   ├── static
│   ├── urls.py
│   ├── views.py
│   └── wsgi.py
├── ocubulum_dashboard
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   ├── 0001_initial.py
│   │   ├── __init__.py
│   │   └── __pycache__
│   │   ├── 0001_initial.cpython-36.pyc
│   │   └── __init__.cpython-36.pyc
│   ├── models.py
│   ├── __pycache__
│   │   ├── admin.cpython-36.pyc
│   │   ├── apps.cpython-36.pyc
│   │   ├── __init__.cpython-36.pyc
│   │   ├── models.cpython-36.pyc
│   │   ├── tests.cpython-36.pyc
│   │   └── views.cpython-36.pyc
│   ├── static
│   │   ├── css
│   │   │   ├── custom.css
│   │   │   └── side-menu.css
│   │   ├── img
│   │   │   └── logo.png
│   │   └── js
│   │   └── ui.js
│   ├── templates
│   │   └── ocubulum
│   │   ├── dashboard.html
│   │   └── layout.html
│   ├── tests.py
│   └── views.py
├── Procfile
├── __pycache__
│   └── __init__.cpython-36.pyc
├── README.md
├── requirements.txt
└── runtime.txt
Try from ..ocubulum_dashboard.models import Researcher.
Or add the folder containing ocubulum_dashboard to your PYTHONPATH.

How set setting environment with DJANGO_SETTINGS_MODULE

I am new in Python \ Django and I have some question about settings environment. I use git for edit my project and on server I have production project. But when I edit project on local machine I have my own settings(DATABASE) so if I pull edited project on server I need to change my settings, so I want to set DJANGO_SETTINGS_MODULE, but I don't know what path I must set and where I must allocate my default setting.
This is my hierarchy:
wow
├── core
│   ├── admin.py
│   ├── api_views.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   ├── 0001_initial.py
│   │   ├── __init__.py
│   │   └── __pycache__
│   ├── models.py
│   ├── __pycache__
│   │   ├── admin.cpython-35.pyc
│   │   ├── api_views.cpython-35.pyc
│   │   ├── __init__.cpython-35.pyc
│   │   ├── models.cpython-35.pyc
│   │   ├── sitemap.cpython-35.pyc
│   │   ├── urls.cpython-35.pyc
│   │   └── views.cpython-35.pyc
│   ├── sitemap.py
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── manage.py
├── media
│   └── core
│   ├── iUcZCekdW68_FrqsEHv.jpg
│   ├── iUcZCekdW68.jpg
│   ├── qWI5I5NuIeg.jpg
│   ├── server1.png
│   └── server2.png
├── not_found
│   ├── admin.py
│   ├── apps.py
│   ├── __init__.py
│   ├── migrations
│   │   ├── __init__.py
│   │   └── __pycache__
│   ├── models.py
│   ├── __pycache__
│   │   ├── admin.cpython-35.pyc
│   │   ├── __init__.cpython-35.pyc
│   │   ├── models.cpython-35.pyc
│   │   ├── urls.cpython-35.pyc
│   │   └── views.cpython-35.pyc
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── requirements.txt
├── settings.py
├── static
│   ├── admin
│   │   ├── css
│   │   ├── fonts
│   │   ├── img
│   │   └── js
│   └── core
│   ├── css
│   ├── img
│   └── js
├── staticfiles
│   ├── admin
│   │   ├── css
│   │   ├── fonts
│   │   ├── img
│   │   └── js
│   └── core
│   ├── css
│   ├── img
│   └── js
├── templates
│   ├── 404.html
│   ├── admin
│   │   ├── base.html
│   │   ├── base_site.html
│   │   └── index.html
│   ├── character.html
│   ├── characters.html
│   ├── checkout.html
│   ├── index.html
│   └── server.html
├── url.xml
└── wow
├── gunicorn.conf.py
├── __init__.py
├── __pycache__
│   ├── __init__.cpython-35.pyc
│   ├── settings.cpython-35.pyc
│   ├── urls.cpython-35.pyc
│   └── wsgi.cpython-35.pyc
├── settings.py
├── urls.py
├── views.py
└── wsgi.py
What i must do, end where i must write os.environ["DJANGO_SETTINGS_MODULE"] = wow.settings, or something like this?

Including markdown converter dependency in python AWS Lambda function

I am building a package to upload as an AWS Lambda function. In trying to include a dependency to Markdown 2.6.8, a python implementation of Markdown. When trying to test the function, I get the error Unable to import module 'markdown-convert': No module named markdown. I see from other similar questions that I may need to compile the dependency files inside Amazon Linux to make them usable with Lambda. I am not familiar with python and wonder if I should also be exploring the way that this code is packaged within an egg, and whether that influences how the dependency is imported. What would you suggest I pursue to try to resolve the error?
Here is the file structure of my package:
.
├── markdown
│   ├── blockparser.py
│   ├── blockprocessors.py
│   ├── extensions
│   │   ├── abbr.py
│   │   ├── admonition.py
│   │   ├── attr_list.py
│   │   ├── codehilite.py
│   │   ├── def_list.py
│   │   ├── extra.py
│   │   ├── fenced_code.py
│   │   ├── footnotes.py
│   │   ├── headerid.py
│   │   ├── __init__.py
│   │   ├── meta.py
│   │   ├── nl2br.py
│   │   ├── __pycache__
│   │   │   ├── abbr.cpython-34.pyc
│   │   │   ├── admonition.cpython-34.pyc
│   │   │   ├── attr_list.cpython-34.pyc
│   │   │   ├── codehilite.cpython-34.pyc
│   │   │   ├── def_list.cpython-34.pyc
│   │   │   ├── extra.cpython-34.pyc
│   │   │   ├── fenced_code.cpython-34.pyc
│   │   │   ├── footnotes.cpython-34.pyc
│   │   │   ├── headerid.cpython-34.pyc
│   │   │   ├── __init__.cpython-34.pyc
│   │   │   ├── meta.cpython-34.pyc
│   │   │   ├── nl2br.cpython-34.pyc
│   │   │   ├── sane_lists.cpython-34.pyc
│   │   │   ├── smart_strong.cpython-34.pyc
│   │   │   ├── smarty.cpython-34.pyc
│   │   │   ├── tables.cpython-34.pyc
│   │   │   ├── toc.cpython-34.pyc
│   │   │   └── wikilinks.cpython-34.pyc
│   │   ├── sane_lists.py
│   │   ├── smart_strong.py
│   │   ├── smarty.py
│   │   ├── tables.py
│   │   ├── toc.py
│   │   └── wikilinks.py
│   ├── __init__.py
│   ├── inlinepatterns.py
│   ├── __main__.py
│   ├── odict.py
│   ├── postprocessors.py
│   ├── preprocessors.py
│   ├── __pycache__
│   │   ├── blockparser.cpython-34.pyc
│   │   ├── blockprocessors.cpython-34.pyc
│   │   ├── __init__.cpython-34.pyc
│   │   ├── inlinepatterns.cpython-34.pyc
│   │   ├── __main__.cpython-34.pyc
│   │   ├── odict.cpython-34.pyc
│   │   ├── postprocessors.cpython-34.pyc
│   │   ├── preprocessors.cpython-34.pyc
│   │   ├── serializers.cpython-34.pyc
│   │   ├── treeprocessors.cpython-34.pyc
│   │   ├── util.cpython-34.pyc
│   │   └── __version__.cpython-34.pyc
│   ├── serializers.py
│   ├── treeprocessors.py
│   ├── util.py
│   └── __version__.py
├── Markdown-2.6.8.egg-info
│   ├── dependency_links.txt
│   ├── installed-files.txt
│   ├── PKG-INFO
│   ├── SOURCES.txt
│   └── top_level.txt
└── markdown-convert.py
The contents of markdown-convert.py:
import markdown
def lambda_handler(event, context):
parsedHTML = {}
parsedHTML[u'text'] = markdown.markdown(event[u'text'])
return parsedHTML
Best advice here is to use virtualenv on your local development machine and install packages with pip.
Then when you are ready, make the lambda package by recursively copying the entire content of <your-virtual-env>/lib/python2.7/site-packages/*. Make sure the content is placed in the root of your zip package. This is very important!
Please, find more details here:
http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html

Serving django app with apache2+mod_wsgi

I have configured a linode server with apache2 and mod_wsgi..
the server is running
wsgi is running
postgre is running and syncdb was successful
what I am having trouble finishing is actually serving the app..
my file structure:
.
├── logfile
└── srv
├── logfile
└── www
└── quickerhub.com
├── admin
│   ├── css
│   │   ├── base.css
│   │   ├── changelists.css
│   │   ├── dashboard.css
│   │   ├── forms.css
│   │   ├── ie.css
│   │   ├── login.css
│   │   ├── rtl.css
│   │   └── widgets.css
│   ├── img
│   │   ├── changelist-bg.gif
│   │   ├── changelist-bg_rtl.gif
│   │   ├── chooser-bg.gif
│   │   ├── chooser_stacked-bg.gif
│   │   ├── default-bg.gif
│   │   ├── default-bg-reverse.gif
│   │   ├── deleted-overlay.gif
│   │   ├── gis
│   │   │   ├── move_vertex_off.png
│   │   │   └── move_vertex_on.png
│   │   ├── icon_addlink.gif
│   │   ├── icon_alert.gif
│   │   ├── icon_calendar.gif
│   │   ├── icon_changelink.gif
│   │   ├── icon_clock.gif
│   │   ├── icon_deletelink.gif
│   │   ├── icon_error.gif
│   │   ├── icon-no.gif
│   │   ├── icon_searchbox.png
│   │   ├── icon_success.gif
│   │   ├── icon-unknown.gif
│   │   ├── icon-yes.gif
│   │   ├── inline-delete-8bit.png
│   │   ├── inline-delete.png
│   │   ├── inline-restore-8bit.png
│   │   ├── inline-restore.png
│   │   ├── inline-splitter-bg.gif
│   │   ├── nav-bg.gif
│   │   ├── nav-bg-grabber.gif
│   │   ├── nav-bg-reverse.gif
│   │   ├── nav-bg-selected.gif
│   │   ├── selector-icons.gif
│   │   ├── selector-search.gif
│   │   ├── sorting-icons.gif
│   │   ├── tool-left.gif
│   │   ├── tool-left_over.gif
│   │   ├── tool-right.gif
│   │   ├── tool-right_over.gif
│   │   ├── tooltag-add.gif
│   │   ├── tooltag-add_over.gif
│   │   ├── tooltag-arrowright.gif
│   │   └── tooltag-arrowright_over.gif
│   └── js
│   ├── actions.js
│   ├── actions.min.js
│   ├── admin
│   │   ├── DateTimeShortcuts.js
│   │   ├── ordering.js
│   │   └── RelatedObjectLookups.js
│   ├── calendar.js
│   ├── collapse.js
│   ├── collapse.min.js
│   ├── core.js
│   ├── getElementsBySelector.js
│   ├── inlines.js
│   ├── inlines.min.js
│   ├── jquery.init.js
│   ├── jquery.js
│   ├── jquery.min.js
│   ├── LICENSE-JQUERY.txt
│   ├── prepopulate.js
│   ├── prepopulate.min.js
│   ├── SelectBox.js
│   ├── SelectFilter2.js
│   ├── timeparse.js
│   └── urlify.js
├── interest
│   ├── django.wsgi
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── settings.py
│   ├── settings.pyc
│   ├── urls.py
│   └── wsgi.py
├── js
│   └── jquery-1.10.1.min.js
├── logfile
├── manage.py
├── README
├── reoccurring
│   ├── admin.py
│   ├── forms.py
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── usagelib.py
│   └── views.py
├── schedule
│   ├── admin.py
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── tests.py
│   ├── usagelib.py
│   └── views.py
├── src
│   ├── facebooksdk
│   │   ├── examples
│   │   │   ├── appengine
│   │   │   │   ├── app.yaml
│   │   │   │   ├── example.html
│   │   │   │   └── example.py
│   │   │   ├── newsfeed
│   │   │   │   ├── app.yaml
│   │   │   │   ├── facebookclient.py
│   │   │   │   ├── static
│   │   │   │   │   ├── base.css
│   │   │   │   │   ├── favicon.ico
│   │   │   │   │   └── robots.txt
│   │   │   │   └── templates
│   │   │   │   ├── base.html
│   │   │   │   ├── home.html
│   │   │   │   └── index.html
│   │   │   ├── oauth
│   │   │   │   ├── app.yaml
│   │   │   │   ├── facebookoauth.py
│   │   │   │   └── oauth.html
│   │   │   └── tornado
│   │   │   ├── example.html
│   │   │   ├── example.py
│   │   │   └── schema.sql
│   │   ├── facebook.py
│   │   ├── facebook_sdk.egg-info
│   │   │   ├── dependency_links.txt
│   │   │   ├── PKG-INFO
│   │   │   ├── SOURCES.txt
│   │   │   └── top_level.txt
│   │   ├── MANIFEST.in
│   │   ├── README.rst
│   │   └── setup.py
│   └── pip-delete-this-directory.txt
├── static
│   └── js
│   └── jquery-1.10.1.min.js
├── templates
│   ├── 404.html
│   ├── 500.html
│   ├── Base.html
│   ├── Home.html
│   ├── Reoccurring.html
│   └── Usersettings.html
└── usersetting
├── admin.py
├── __init__.py
├── __init__.pyc
├── models.py
├── models.pyc
└── views.py
my django.wsgi:
import os
import sys
sys.path.append('/srv/www/quickerhub.com/')
os.environ['PYTHON_EGG_CACHE'] = '/srv/www/quickerhub.com.python-egg'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
my httpd.conf:
my sites-enabled/quickerhub.com:
WSGIPythonPath /srv/www/quickerhub.com
<VirtualHost *:80>
ServerName quickerhub.com
Alias /static/ /srv/www/quickerhub.com/interest/static/
WSGIScriptAlias / /srv/www/quickerhub.com/interest/django.wsgi
<Directory />
AllowOverride None
Options -Indexes
</Directory>
</VirtualHost>
I feel like everything is pointing to the correct stuff...
EDIT:
Now just getting a 404 file not found
Please help!
Thanks!
I just setup my site www.noobniche.com on Linode using WSGI. Unfortunately I'm not at home to compare my setup, if you're still having problems tonight I can look into it. From memory in my case, I had to enable by adding to sites-enabled and sites-available.
the structure should look something similar to this;
webapps(root directory)
nichesite
static
django_project_name
--> myproject.wsgi
--> settings.py
--> urls.py
--> views.py
manage.py
it seems your .wsgi file is located in your root directory, when it should be located within your django project folder.
So it looks as if you have conflicting settings for WSGIScriptAlias - one in httpd.conf, pointing to the right path for your wsgi file, and one in your sites-enabled file, pointing to the wrong path (/var/ instead of /srv/).
You should remove the one in httpd.conf and move it to sites-enabled/quickerhub.com so that the version there is correctly pointing to /srv/.

Categories

Resources