Bitnami Django Stack - not importing modules - django

I just tried deploying my Django application on my windows machine using Bitnami's Django stack. However, when I try to access my project via localhost/myapp/, I get an error stating that I can't load my modules/python libraries. I checked via pip and I have these modules installed. It seems this error applies to all my modules/python libraries. How do I solve this? Thanks!

When you install the Bitnami Django Stack, it will ask you for changing Association Setting for Python with the following message:
"This option lets you change the Windows properties to associate the Python files to the new Python that are going to be installed. If you have your own Python you may want to disable this feature."
If you decided to use your Python instead of the one that is installed with the Stack, you have must ensure that you have installed Python in your system and all the modules and libraries are loaded, otherwise you won't be able to use any of them.

Related

How to run a function in the background-Django

I want to run an API call after every 5 mins in the app. I want to generate a notification whenever new data is added to the database through the API.So to check this I need to run the task in background to make it a real time application.
How can I achieve this task in Django?
I am facing multiple errors while using django background_tasks so I don't want to use it. Celery is not compatible with windows. Is there any other option whose tutorial is available also
As you mentioned in your another question here ,
you previously have installed django-background-task instead of django-background-tasks [notice the difference between task and tasks]. So you have got ImportError: cannot import name 'background' from 'background_task'.
Later you installed the proper one i.e django-background-tasks and then you uninstalled django-background-task which also uninstalled some of the dependencies of django-background-tasks.
SOLUTION: Uninstall both packages first. Then pip install django-background-tasks

Import setup module error while deploying to app engine via google cloud sdk

I am writing after a lot of searching and trial and error with no luck.
I am trying to deploy a service in app engine.
You might be aware that deploying on app engine is usually practiced a two step process
1. Deploy on local dev app server
2. If step 1 succeeds deploy on cloud
My problems are with step 1 when I include third party python libraries such as numpy, sklearn, gcloud etc.
I am trying to deploy a service in local devapp server. When I import numpy or any other third party libraries in my main.py script it throws an error saying unable to find the module.
I am using cloud sdk and have two python distributions, the default python 2.7 and anaconda with python 2.7. When I change the path to look for the modules in anaconda distribution, it fails to find module ‘setup’ required by the cloud sdk.
Is there a way to install the cloud sdk for anaconda distribution ?
Any help/pointers will be much appreciated!
When using app engine python standard environment, you can install pure python 3rd party libs using pip by vendoring them as explained here.
There are also a number of libraries included in the python27 runtime which can be requested using the libraries directive in your app.yaml as explained here.
If there's a lib which is not pure python (i.e it uses C extensions) that you want to use in your project, and it's not part of this list, then your only option is to use a flexible VM. If you want to use anaconda, you should consider customizing the runtime for your flexible VM.

Configure Web2Py to use Anaconda Python

I am new to Web2Py and Python stack. I need to use a module in my Web2Py application which uses "gensim" and "nltk" libraries. I tried installing these into my Python 2.7 on a Windows 7 environment but came across several errors due to some issues with "numpy" and "scipy" installations on Windows 7. Then I ended up resolving those errors by uninstalling Python 2.7 and instead installing Anaconda Python which successfully installed the required "gensim" and "nltk" libraries.
So, at this stage I am able to see all these "gensim" and "nltk" libraries resolving properly without any error in "Spyder" and "PyCharm". However, when I run my application in Web2Py, it still complains about "gensim" and gives this error: <type 'exceptions.ImportError'> No module named gensim
My guess is if I can configure Web2Py to use the Anaconda Python then this issue would be resolved.
I need to know if it's possible to configure Web2Py to use Anaconda Python and if it is then how do I do that?
Otherwise, if someone knows of some other way resolve that "gensim" error in Web2Py kindly share your thoughts.
All your help would be highly appreciated.
The Windows binary includes it's own Python interpreter and will therefore not see any packages you have in your local Python installation.
If you already have Python installed, you should instead run web2py from source.

How apps installed at pip really works?

I'm new at django and i was looking for a wysiwyg and i fuond tinymce.
I installed at pip command line and i expect that create a folder at my folder project like a new app. It dont created no one folder but i did the next steps and for my surprise the app works fine at my project.
I want to know how this app really works at my project, in case im gonne deploy this project and how to deploy the app installed at pip or something like that.
My englhish is not good but i hope that was clear.
The applications, or libraries rather are copied directly inside one of the folders inside your python directory called Lib/site-packages. This exact location depends on your operating system you can find usually find your newly installed packages under
For Windows
C:/PythonXX/Lib/site-packages/
For Linux
/usr/local/lib/pythonX.Y/site-packages
When you run a python script, Python will automatically include these folders as available resources, and when you add for example import X to your code, it will check to see if X is listed.
You have more information on the topic available here.

Django: Setting up apps on a server

Trying to upload my django app on my obunto slice. The problem I'm facing right now there are a couple of packages I'm using. Which I installed in site packages on my machine. Now when I put them online on the server their sadly not working. Any ideas how to make them work.
p.s I get a error on import
Python must have a way to find these packages. Did you use standard installation procedures for them (i.e. setup.py install) or copy them in an accessible directory? If you didn't use setup.py install, check your PYTHONPATH environment variable. It should contain the directory where your packages are stored. If it doesn't, you can create it.
This is a Python issue really, not a Django issue.
To get more help paste the import error you're getting, as well as the directory structure of where you installed this package.