Google App Engine and Django support - django

I'm trying to deploy my Django app to Google App Engine (GAE) as per this document. I created and configured a Google Cloud SQL instance, as described in that document. I use PyCharm as development environment and created a GAE project with Django support.
I configured a local server to point to the GAE server. When I try to launch the GAE local server in PyCharm, it's raising exceptions on an improperly configured database in SETTINGS.PY:
google.appengine.ext.django.backends.rdbms' isn't an available database backend
I can see from the stack trace that the local server is using the Django version in /Library/Python/2.7/site-packages while I presume it should use the one in /usr/local/google_appengine/lib.
What would be the best way to solve this given that I have other Django projects as well that should use the Django version in /Library/Python/2.7/site-packages? If I modify my PYTHONPATH to include the GAE version of Django, would not all my projects be referencing that version of Django?
EDIT: To be more precise, the GAE local server starts just fine but throws the mentioned stack trace when I do a syncdb task to update my database.
EDIT 2: In PyCharm Settings under Python Interpreter, I found the possibility to modify paths and added the Django 1.4 version as distributed with GAE SDK. When I start the GAE development server, I can actually see it uses the Django version from the GAE SDK but it still crashes on the database definitions:
Error was: No module named google.appengine.ext.django.backends.rdbms.base
EDIT 3: I ran into problems when trying to deploy an existing Django app using the tutorial. See this separate question.

Looks like PyCharms call of syncdb is using the wrong Django installation.
google.appengine.ext.django.backends.rdbms is not part of the official Django distribution, but it is part of GAEs django.
My GAE django is in /usr/local/google_appengine/lib/
If you're on linux/OS X you could add this to your .bashrc/.bash_profile and make syncdb use this:
export GAE="/usr/local/google_appengine"
export PYTHONPATH="$PYTHONPATH:$GAE:$GAE/lib/django_1_4"
export PATH=${PATH}:$GAE/lib/django_1_4/django/bin/
export PATH=${PATH}:/usr/local/mysql/bin
I wrote a tutorial about using Django with GAE and Google Cloud SQL. There might be some relevant infos there as well.

Related

Deploy Django project with MSSQL DB in Local Server

I am new in Django and this will be my very FIRST Times web deploying. So I am trying to deploy my project to the local server and My project stack is Django with MSSQL so obviously I will need Window.
I was read the documentation and I think I will need WSGI and As the documentation say to deploy with gunicron or uWSGI but both are supported for Unix and not for window. So How can I start this one? This will be the first question.
I would like to know whether I am doing is correct or not.
Now I copy my project to the local server and when I try to run my project like python manage.py runserver it asks me to install Django and other but I thought this environment is working at well my computer and all of the needed application is already installed in the environment. So I still need to install all of my needed apps like Django to this environment again?
If u have any tutorial or can guide me to some useful site, I will be very very appreciated.
Anything u want to know further, Just let me know.
Thanks.

Is it possible to build a portable webapp when using oracle with django

I started developing a django webapp which will need to connect to oracle databases. But using oracle with django requires an Oracle client if I'm not mistaken which is platform dependant. If it's not possible to create a portable webapp with django and oracle, could the app use an oracle client install on the machine where the app is running?
Thanks
What do you mean by "portable" exactly ? You can definitely move your Django folder around, especially if you use SQLite for database storage, since a SQLite database is just a file.
All you'll need is Python on the target machine, access to the command line and the ability to install your dependencies with pip.
Then you can just run your webapp with python manage.py runserver.
If this doesn't answer your question, please give more info.

python 2.7 django 1.6 how to set my application on a free server

I am new on hosting servers and i want to know the easiest way to get my django app running on a free/or not hosting server.
Please give some very detail information's and suggestions!!!
My application is built on python 2.7 with Django 1.6
Follow this documentation :
https://devcenter.heroku.com/articles/getting-started-with-django

Django site on Webfaction - how the flow of information works, and integrating with Pycharm remote dev

I have been learning Django in the development mode for a two months and I am up to speed with most basic aspects of python + django now. However, I was using the built-in runserver till this time
Now, I have got a Webfaction hosting account and wanted to know the following
1) Webfaction sets up the project with a certain Django version (say 1.6.4) and Python version (say 2.7) initially
The project directory (for say project MYAPP) is /<>/webapps/MYAPP
When the site is running in production mode, how does the apache server know which Python version, and which site-packages versions to use with the MYAPP source code to render the site?
I can see that the MYAPP folder has a lib/python2.7 folder, however when I am connected to SSH terminal, and do a "which python", i see :
which python
/usr/local/bin/python
so, do I take that this is the Python executable that is being used for rendering the website instead of the one in webapps/MYSITE/lib/python2.7 folder? How does the information/data flow about which programs to use during rendering the site with apache mod_wsgi work?
2) I was using a virtualenv in the development mode during testing. How do I use this on webfaction in production mode?
3) I am using Pycharm IDE. It worked well for the development mode. I can see that it has a remote interpreter configuration and a Deployment setting/option.
The python path that the remote interpreter settings tool detects automatically is the python executable at /usr/local/bin/python
Is this fine, or should I be pointing it to the more local python2.7 in the webapps/lib folder?
Thanks a lot of the answers and pls let me know if you need any supplemental info
Note to the OP: This should really be three separate questions.
1) For WebFaction, your Django app will use the Python version (and libraries, etc.) defined in:
~/webapps/<appname>/apache2/conf/httpd.conf
Specifically, you'll want to look at what is defined for WSGIPythonPath (which should mostly match up with WSGIDaemonProcess unless you modify the config and are doing something strange).
Note that which python just tells you what the default python is in your shell. This has nothing to do with the config file for the webapp.
2) You may want to expand on this as to exactly what your use case is and why the default Django webapp created by WebFaction doesn't fit your needs. But the short answer is:
Create a virtualenv on your WebFaction account.
Install Django, etc. into the virtualenv.
Edit the httpd.conf file I mentioned above to use your virtualenv instead.
I've done this with both a Django webapp made via the WebFaction control panel and via a custom mod_wsgi webapp. So it does work. Just make sure to use the right Python version when making your virtualenv.
3) I don't use PyCharm so I can't answer this (one reason why this question should be split up).

Django openid (google-app-engine) error: No module named django_openid_auth

I'd like my users to be able to log in to my django project using their google accounts login (instead of having to sign up and create a new one). I found this : http://learnedstuffs.wordpress.com/2012/05/22/django-google-account-authentication/
But it doesn't work for me. After deploying my project in to Google apps engine it shows an error: ImportError: No module named django_openid_auth. I've checked many times - i did install django-openid-auth (by virtualenv). I'm new to django and I have no idea what I'm doing wrong.
Can anybody please help me with it? Thanks!
I found the solution: Packages installed in system or virtualenv environments won't get uploaded to GAE production servers. Packages should be in GAE project folder.