I am using flask. I installed Flask-migrate and have been using it to migrate my postgresql db. It works fine on my local box. However, when I run it on openshift I get an error
"File "/opt/rh/python27/root/usr/lib64/python2.7/ConfigParser.py", line 396, in set
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'alembic'
"
Anyone know what this is or how to fix it?
It probably means that Flask Migrate is unable to find alembic configuration. Flask Migrate depends on Alembic to generate db revisions.
By default, Flask Migrate searches for configuration(and db version scripts) in migrations directory. If your configuration is present in different folder, you can specify it using -d <dir>
I think this is a bug with LD_Library_path that should be fixed in this sprint. Should be rolling out to production in a week or two
Related
I want to import and use dataset package of python at AWS Lambda. The dataset package is about MySQL connection and executing queries. But, when I try to import it, there is an error.
"libmysqlclient.so.18: cannot open shared object file: No such file or directory"
I think that the problem is because MySQL client package is necessary. But, there is no MySQL package in the machine of AWS Lambda.
How to add the third party program and how to link that?
You should install your packages in your lambda folder :
$ pip install YOUR_MODULE -t YOUR_LAMBDA_FOLDER
And then, compress your whole directory in a zip to upload in you lambda.
What you have to do is to include the binaries needed with your lambda package.
You need to utilize pip and create an isolated environment.Your zip uploaded to lambda needs to have the python2.7/site-packages included (the ones installed with pip).
Now there are extreme cases of os-related dependencies.
This has a tricky solution.
In those cases you have to spawn an amazon linux ec2 instance in order to build/get those dependencies and package them with your lambda.
Once your lambda is packaged you can close the ec2 instance.
Check this guide if virtualenv is not enough.
This is an os dependent system file. I'm guessing that you successfully installed the Python mysql client, but you still need the system mysql client, which seems to be a different version on your system than the lambda one. While building your virtual environment on the official lambda image will definitely fix this problem, you might have some luck copying your own copy of this system file into your lambda zip file.
I found mine with
locate libmysqlclient.so.18
Note: depending on your system, the version number at the end might be different. Use the version in the error you receive.
Adding that file on the top level of my zip file with
cd \path\from\locate\to\libmysqlclient
followed by
zip -u \path\to\lambda\zip\file.zip libmysqlclient.so.18
worked for me.
I went to build a new python pyramid app on OpenshiftV2 like I always do today and I get this error when I deployed to openshift. I ssh'd in and I can see my virtual env has six 1.10.0 install but for some reason openshift thinks I have 1.3. Maybe Openshift is not activating the venv? Openshift will not let me pip upgrade, install, or uninstall.
I seem to remember this happening a couple of years ago but can't remember how to resolve. I seem to remember it was a Openshift bug but not sure.
Any ideas?
File "/opt/rh/python33/root/usr/lib/python3.3/site-packages/pkg_resources.py", line 728, in require
needed = self.resolve(parse_requirements(requirements))
File "/opt/rh/python33/root/usr/lib/python3.3/site-packages/pkg_resources.py", line 630, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (six 1.3.0 (/opt/rh/python33/root/usr/lib/python3.3/site-packages), Requirement.parse('six>=1.5'))
The Openshift repo must have been corrupted somehow. I deleted the app and recreated from scratch and it works fine now.
I had an py27 application running on aws ElasticBeanStalk for over a year. Recently it stopped working. So I tried to redeploy. During redeploy I got the following error in the logs:
Return code: 1 Output: [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03deploy.py]
command failed with error code 1:
/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py
New python executable in /opt/python/run/venv/bin/python27
Not overwriting existing python script /opt/python/run/venv/bin/python
(you must use /opt/python/run/venv/bin/python27)
Can somebody tell me where I will find /opt/python/run/venv/bin/python? How can I change it to
/opt/python/run/venv/bin/python27?
Thanks
When you redeployed, you opted into the latest beanstalk version, which uses a different AMI than the one originally used. If you're familiar with the concept of ebextensions then you're probably looking to add a file like this:
.ebextensions/python.config:
ln -s /opt/python/run/venv/bin/python27 /opt/python/run/venv/bin/python
I would like to connect my web application (running on tomcat 7) to MySQL (v5.6.20). It is ok if I include the driver mysql-connector-java-5.1.31-bin.jar into my web application. But would like to have it for all my apps. On my local computer, I put the file in tomcat/lib and everything is fine.
How to do the same with openshift? Is it a bad idea to do so?
I am a total beginner. What I do to upload my application (war files) is
git add --all
git commit --m "text"
git push
Thanks a lot for your help!!
Here are two KB articles from the Help Center that I think will help you get going, the first shows how to use the pre-configured database connections that come with each of the Java containers on OpenShift (https://help.openshift.com/hc/en-us/articles/202399720-How-to-use-the-pre-configured-MySQLDS-and-PostgreSQLDS-data-sources-in-the-Java-cartridges), They are very easy to use.
The second shows you how to include external libraries (jar files) inside your application without using maven (https://help.openshift.com/hc/en-us/articles/202399730-How-to-include-libraries-jar-files-in-your-java-application-without-using-Maven).
A third option, if you are using a Maven based project (similar to the default applications that come with the Java cartridges), is to add the mysql driver as a dependency to your pom.xml file, and it will be loaded into the correct place in your application when you do a git push. If you want to go that route, I think that this article will help: http://www.java-tutorial.ch/core-java-tutorial/mysql-with-java-and-maven-tutorial
I am new to django and python in general, so pardon me for any simple mistakes I may be doing. I am trying to setup my first django project on my local windows vista machine. I have created the project successfully with no problems. The issue I am coming across is when my settings.py has values for my database keys, the manage.py runserver command is failing. If I have values in settings before I run the command, as soon as I run it I get errors. If I have already run the command and the server is running, as soon as I edit the settings file with values, the errors show up in my still open command prompt. The inner most exception seems to "Error loading MySQLdb module: No module named MYSQLdb". If I leave the settings.py blank, the command executes with no problems.
Any advice would be greatly appreciated!
Thanks
You don't have mysql-python module installed, thats why you getting that error.
You could find that module at
http://pypi.python.org/pypi/MySQL-python/
Install the MySQLdb module, or the oursql module along with the django-oursql connector.