I'm following the tutorial in the Haystack for using solr in django. I download haystack ad it to my installed apps, and I like to check my development to make sure my apps still working. So when I go to my my localhost it says
A server error occurred. Please contact the administrator.
and in my terminal it says
raise MissingDependency("The 'solr' backend requires the installation of 'pysolr'. Please refer to the documentation.")
and when I go to the pysolr documentation it seems as if it's to be used without haystack. There is no mention pysolr in haystack docs and no mention of haystack in pysolr docs. Not only that, but pysolr gives an example that says
# If on Python 2.X
Im using python 3. I understand theres a learning curve but is there anything that has all the resources in one post? Or must I just trial and error it out? and also can it be Kind of up to date? 2.x to 3.5 is a big gap. There are surprisingly no google videos or vimeo videos on this. any and all help is welcome. I know anything worth having or knowing isn't easy to come by but sheesh? the few sites Ive seen also have the url like this in urls.py
(r'^search/', include('haystack.urls')),
but if I do it like that I get an error
regex_pattern = pattern.regex.pattern
AttributeError: 'tuple' object has no attribute 'regex'
this may seem like nothing to someone experienced, but to the untrained this can lead to a lot of confusion to the proper syntax.
Haystack uses different adapters to talk to different backend services, such as ElasticSearch or Solr.
The Solr adapter uses pysolr:
You’ll also need a Solr binding, pysolr. The official pysolr package, distributed via PyPI, is the best version to use (2.1.0+). Place pysolr.py somewhere on your PYTHONPATH.
You shouldn't have to do anything with pysolr yourself, as that is only used inside the haystack Solr adapter. Be sure to follow the tutorial for setting up the schema and getting the indexing running.
just pip install pysolr and move about your day.
Personally, I used(in my virtual env):
python3 -m pip install pysolr
Related
Trying to find an example of how to build an application using solr 5.x with django-haystack, but most examples online are using solr 4.x or solr 3.x. Can anyone give some instructions on how to work with solr 5.x using django-haystack, or just offer some example project? Thanks!
It seems Django-Haystack does not support SOLR 5 well. SOLR 5's solrconfig.xml file for its core uses ManagedIndexSchemaFactory as default schemaFactory. If you change it to ClassicIndexSchemaFactory, you will run in troubles with your schema.xml which is generated by python manage.py build_solr_schema. Lots of fields' types are not supported. Probably going back to SOLR 4 would be a better choice
So I've been tasked with upgrading a Django server from 1.6.2 to the latest (~1.8), along with upgrading Python from 2.7.3 to 3.3. I suspect this is going to break quite a bit of code. (I even need to upgrade the Ubuntu installation from 12.04 to 14.04)
I would like to migrate my Django app from the server it's currently running on (Ubuntu 12.04) to a virtual machine, and use that environment as a sandbox to make changes.
Would anyone be so kind to provide guidance on django app migration? Please let me know if you'd like me to provide any specific details.
Thank you.
Edit: If anyone would like to vote down this question because they believe I haven't done enough research, I'm very happy to add missing information, if I know what you're looking for.
Django versions from 1.5 onwards has been designed so that the same code will work on both versions of Python as in the documentation thanks to them following the six compatibility layer.
You might face some issues with code that isn't strictly related to Django components like print statements and other such parts that might have been coded in. The official Python Porting Guide should held you with that.
Django 1.8 is a LTS (Long Term Release) so it's a good idea to upgrade to it. Migrating the database might be a bit of an issue considering it's from 2.7 to 3.4 but that's in all likelihood the place you'll find most issue with. The How to Migrate is a great resource.
If I recall correctly the directory structure is a bit different in 1.6 so you'll have to move some code and files manually. I suggest having the tutorial pages for both versions 1.6 and 1.8 open and comparing the directory structure.
Going through the first 2 pages of the tutorial should give you enough of an overview to migrate the database and the settings file. This should also help with migrations.
The 3rd and 4th pages should get you through migrating the views and urls files.
The only thing I'm not familiar with is the migration of the wsgi file which has configuration information, you should be able to find some basic information about that here.
Updating your Ubuntu however won't change or affect anything at all.
Also as has been said in the comments by jape and joel, it's a good idea to use virtualenv and git.
I would like to add another suggestion based on my own experience with pushing code to a Django server :
Download the code base to your local machine and work there and once you're done and the server is working well on your machine push it all to the server at once. That way you can isolate server machine specific issues from coding issues.
My problem is down to my lack of experience with django (and coding) and stripe.
I am trying to test a very basic stripe payment on a test form on my local development server, but I am getting an error message when I try to start my local development server.
Here is a a screen grab of the issue:
Can somone give me an idea of what I have done wrong and how I even start to go about solving the issue? I am using djstripe which I have pip installed.
I have searched my templates and gone over my code and SO and Google, but I am still stumped. I have djstripe installed in my INSTALLED_APPS.
Is there a tutorial of how to read and interpret the errors in the above screen grab, or does the understanding mainly come from experience?
You need to define STRIPE_PUBLIC_KEY (and STRIPE_SECRET_KEY I believe) in your settings.py. You can get this key from stripe if you have an account.
If you follow the instructions you will see this. https://github.com/pydanny/dj-stripe
A google search for "reading python stack trace" gives us this:
https://www.odoo.com/forum/help-1/question/how-to-read-and-understand-errors-from-tracebacks-9704
I've created a basic mongoengine app using the pyramid_mongodb scaffold...however I'd like to include mongoengine. I'm wondering what I should actually keep from the scaffolds code.
Not a answer regarding the scaffold. I wouldn't recommend using the scaffold since it's not really usable for root_factory and so on, the subscribers isn't really needed too.
I wrote an addon for pyramid. It's called pyramid_mongo.
Documentation:
http://packages.python.org/pyramid_mongo/
Github:
https://github.com/llacroix/pyramid_mongo
I saw your question today and felt it could be a good addon to the plugin.
I just pushed it to github so you need to clone it from there for now, installing using pip will load the old version without support for mongoengine.
In other words in your config, do everything like in the docs and add something like:
mongo.mongoengine=true
It will attach mongo from the config to mongoengine. All other api will work with or without mongoengine and mongoengine should work. It just added it today, it doesn't support multiple connections and multiple dbs. I can also add support for multiple dbs too. But I feel mongoengine may do some things on his own that could conflict with my plugin like authorization.
Once I write tests, I'll push it to python packages and it will be possible to install from pip or easy_install. For now, pull it from github
I am trying to create a web application using Pylons and the resources on the web point to the PylonsBook page which isn't of much help. I want authentication and authorisation and is there anyway to setup Authkit to work easily with Pylons?
I tried downloading the SimpleSiteTemplate from the cheeseshop but wasn't able to run the setup-app command. It throws up an error:
File "/home/cnu/env/lib/python2.5/site-packages/SQLAlchemy-0.4.7-py2.5.egg/sqlalchemy/schema.py", line 96, in __call__
table = metadata.tables[key]
AttributeError: 'module' object has no attribute 'tables'
I use Pylons 0.9.7rc1, SQLAlchemy 0.4.7, Authkit 0.4.
Ok, another update on the subject. It seems that the cheeseshop template is broken. I've followed the chapter you linked in the post and it seems that authkit is working fine. There are some caveats:
sqlalchemy has to be in 0.5 version
authkit has to be the dev version from svn (easy_install authkit==dev)
I managed to get it working fine.
I gave up on authkit and rolled my own:
http://tonylandis.com/openid-db-authentication-in-pylons-is-easy-with-rpx/
I don't think AuthKit is actively maintained anymore. It does use the Paste (http://pythonpaste.org) libs though for things like HTTP Basic/Digest authentication. I would probably go ahead and take a look at the source for some inspiration and then use the Paste tools if you want to use HTTP authentication.
There is also OpenID which is very easy to setup. The python-openid libs have an excellent example that is easy to translate to WSGI for wrapping a Pylons app. You can look at an example:
http://ionrock.org/hg/brightcontent-main/file/d87b7dcc606c/brightcontent/plugins/openidauth.py
This actually got me interested:Check out this mailing on the pylons list. So AuthKit is being developed, and I will follow the book and get back on the results.