I have a Vue, Django integrated project. I hosted the Vue project on Netlify and the Django project on Heroku. A python script (integrated into Heroku) is called on certain buttons which extract data and posts this to the Django API to be viewed on the frontend.
I have trained a font type for my pytesseract OCR script. However, when i run it on Heroku, it seems like i can only use the 'eng' (normal font) as 'language' for my pytesseract image_to_string function. If I have the .traineddata file of the font type that I want to use, how can I use this file within the pytesseract functions? I can call the individual file, but I need the right TESSDATA_PREFIX as well. Does someone know how to deal with this?
Thanks!
I had the same issue. It is olved by setting TESSDATA_PREFIX Config Var to a custom directory and inserting all .traineddata files to that directory.
Related
So I've been trying to serve my svelteKit app using Flask but it seems like Flask doesn't getting any assets such as css or js. Maybe it was due to my folder stucture configuration using FLASK? Does anyone have the solution for this? the npm run preview seems to be working just fine.
This is how I set up the Flask app:
app = Flask(__name__,static_folder="static",template_folder="build", static_url_path="/build/static")
Stucture of the built project
Script tag inside index.html
The front-end when served
I've tried changing the import path inside index.html script tag as well as ensuring the files are existed in the location but nothing changed.
I have a Django Project for which I am trying to find a way to deploy as a .war file.
My objective is
to not reveal the source code during deployment
to De-Couple Django App from Database and deploy as a .war file. This will help me to update the app without re-initializing database.
As Jython is not supported for Python3, is there an alternative?
I also tried to create an exe through PyIntsaller but it acts as a malicious executable.
I'm new to Django and Python, I'm coming from Laravel.
I'm working on a Windows machine.
My Laravel project has tons of folders (vendor etc.) and is >100 MB my Django project is <50kB.
In the end, I want to upload my Django project to a webserver.
But I'm curious where the Djangofiles on my computer are located, and how deployment works. (what are the essential parts/files compared to Laravel (Project Folder + DATABASE) which I've to transfer)
Is the Django Framework similar to a Javascript file, which I can put I my project folder or get via linking?
The place you move your Django project folder to on your server is where your Django files is located. Django files might be small in size, however, to run your Django application you will need to install +100MB packages from PIP.
The essential part of Django is your project directory and your requirements.txt file in which all python package required to run your application will be listed in it.
Django is not similar to a Javascript file, Django is a complete web development framework similar to Laravel framework, you may refer to this Head-to-Head comparison between Django and Laravel: Here
For more details on deployment you may refer to the following tutorials:
Hosting Django with Nginx: Nginx + Django
Hosting Django with Apache: Apache + Django
I've deployed a Django app on Azure and run it, everything was working fine css, images, js. After i run Gunicorn to automate the site then Only skeleton HTML displayed, css, images and js disappeared.
this is the Erro:
/home/honest/venv/lib/python3.6/site-packages/django/core/handlers/base.py:58: FutureWarning: TemplateForDeviceMiddleware is deprecated. Please remove it from your middleware settings.
mw_instance = mw_class()
/home/honest/venv/lib/python3.6/site-packages/django/core/handlers/base.py:58: FutureWarning: TemplateForHostMiddleware is deprecated. Please upgrade to the template loader.
Not Found: /static/images/sample/slider/img7.png/
May i know if i need to configure WhiteNoise for gunicorn on Azure?
Do i Need to edit my HTML templates to point to static folder in Azure?
I tried some of the solutions i saw here like setting DEBURG to True set path for static files in Settings.py but it couldn't help.
I will be glad receiving a step by step solution to this.
Thanks for the assistence.
I have a django project under a virtualenv.
I included the django-zurb-foundation 5.3.0 package to use foundation but this version only include static css files.
It's my first time using django and normally i use foundation with sass using bower and grunt.
How can i do to use the sass version of foundation?
What should be the files tree?
UPDATE
i installed django compressor and i got it work on local, it works perfectly, but i cannot get it to work on my production server:
on local env i have a CACHE folder with the css static files in it and the html page call correctly the file from there.
On the prod site instead, it doesnt create the CACHE folder and it doesnt render the path to it and it keeps the path to the scss file.
What am i doing wrong?
It seems like compressor isnt working on the prod server, i'm afraid i'm doing something wrong with django settings.py since i'm new to it.
any help?
I have heard of a few people using django-bower with foundation, personally I have not played with it but its worth looking into if you have not already.
I really can't find a reason to use a third party Django application to do that, using front-end frameworks like foundation or Bootstrap is as simple as compiling the less or sass source files to a css file and include it in your html (<link rel="stylesheet"...).
With Django you can use Bower and Grunt without any problem because they're independent and totally configurable to fill your needs. What I do with bower is to create a .bowerrc file at the same level of the bower.json file with the directory setting pointing to the main static folder, something like:
{
"directory": "my_django_app/static/bower_components"
}
Talking about the django-compressor app all that I can say is I don't recommend to use it in a production environment, it has some performance problems and personally I prefer the static files to be responsibility of the front-end dev instead of the back-end dev. For example you will need to have source maps for your javascript for debugging purposes and I don't remember if it's possible with this plugin.
Instead of using the django-compressor you can use a grunt plugin to to it, I've done one that may help you to do so: https://www.npmjs.org/package/grunt-django-compressor