I just installed Solr and Haystack for a Django project I'm working on. Following this Haystack tutorial I created a schema.xml but I'm not sure where to place it in the Solr installation.
My Solr installation is in a directory like this: /solr and I'm starting the Solr service from /solr/example with this command java -jar start.jar.
Any ideas where to place that schema.xml and how to tell Solr to use it?
Solr looks for schema.xml in the ./conf directory under the "Solr home" directory.
See this page for more info.
http://wiki.apache.org/solr/ConfiguringSolr
It has to do with the details of the core your've created. Ideally the first step of using solr would be creating your core like this
./bin/solr create -c haystack where haystack is the name of your core
Now you can see a new directory has been created as ./server/solr/haystack/conf which is where schema.xml should be copied into.
Related
I am using PyInstaller for creating build for my project on ubuntu machine.
I have written one custom commands createsappsuperuser in django to create sime special users. To create the executable file, I am running my manage.spec file and the executable is getting created successfully. The location of that executable is in dist folder.
After that I am running ./dist/manage createsappsuperuser which gives error like -
Unknown command: 'createsappsuperuser'. Did you mean createsuperuser?
Type 'manage help' for usage.
To solve the above issue, I tried adding my cusom command in the dict
in Pyinstaller/loader/rthooks/pyi_rth_django.py file as because pyi_rth_django.py always return some static set of commands.
I have added it like 'createsappsuperuser': 'idmgmt' in the dictionary. Here, idmgmt is my app name.
But the above solutions was valid for upto Django 1.8, and even the file "pyi_rth_django.py" says that it is tested with Django 1.8.
Then how should i do it in Django 2.1.5 ?
Thanks In Advance
I'm trying to deploy a small django app on heliohost following the instructions in this post How to deploy a Django site using a different version of Django on Heliohost and also the official ones. But when I try to browse the site I only get the index of my public_html folder. Does anyone have any idea what I am doing wrong?
I know this is old post but if you still trying django on heliohost, try cookiecutter template for heliohost.
$ pip install cookiecutter
$ cookiecutter https://github.com/rahul-gj/cookiecutter-helio.git
project_name [mysite]: ---> Type your project name here.
helio_user [user_name]: ---> your heliohost username.
The folder with project name will be created in your working directory.
Paste the content of the folder (folder + manage.py file) on heliohost public_html directory.
go to yourusername.heliohost.org/yourproject
You should see something like this:
https://krydos.heliohost.org/djangotest/
Explore the django on heliohost.
I'm trying to implement search to my django based website.
While following the tutorial I found this:
If you’re using the Solr backend, you have an extra step. Solr’s
configuration is XML-based, so you’ll need to manually regenerate the
schema. You should run ./manage.py build_solr_schema first, drop the
XML output in your Solr’s schema.xml file and restart your Solr
server.
First, I don't know where to put my schema.xml, after some resarch I figured I'd create a folder inside my project to put it: myprojectname/solr/schema.xml. Is that right?
Second, how do I restart Solr?
UPDATE
I downloaded Solr,unzipped it and I put the schema.xml generated inside example/solr/conf
then I start solr java -jar start.jar
but when I try to build the index :
./manage.py rebuild_index
I get :
WARNING: This will irreparably remove EVERYTHING from your search index.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y
Removing all documents from your index because you said so.
All documents removed.
Indexing 1 News.
Failed to add documents to Solr: [Reason: None]
<response><lst name="responseHeader"><int name="status">400</int><int name="QTime">4</int></lst><lst name="error"><str name="msg">ERROR: [doc=news.news.2] unknown field 'django_id'</str><int name="code">400</int></lst></response>
Indexing 1 entries.
Failed to add documents to Solr: [Reason: None]
<response><lst name="responseHeader"><int name="status">400</int><int name="QTime">17</int></lst><lst name="error"><str name="msg">ERROR: [doc=zinnia.entry.2] unknown field 'django_id'</str><int name="code">400</int></lst></response>
I verified my schema.xml ,and I do have :
<field name="django_ct" type="string" indexed="true" stored="true" multiValued="false" />
<field name="django_id" type="string" indexed="true" stored="true" multiValued="false" />
P.S.
I'm using Django 1.2 and Haystack 1.2.7
The solr server needs to have a copy of your schema.xml not django. I usually keep a copy of the schema.xml in my django project for version control, but solr can't find it there.
Is you solr server local? Are you using a hosted or remote Solr service? I develop locally then use websolr b/c i dont want to configure solr for production.
For local dev on OSX
I'm assuming this is local development on OSX and that you have homebrew installed (assumptions - give me more info if this isnt the case):
brew install solr
This is going to install Solr at someplace like: /usr/local/Cellar/solr/...
Note: When im developing locally, I like to use fabric for running deployment and some startup tasks.
So in my fabfile.py I have a fabric command to copy my schema.xml into the proper file and start the solr server (I just run fab solr at the cmd line)
def solr() :
# build a new updated schema.xml (changes to indexes/models may require this so always do it for local testing)
local('python manage.py build_solr_schema > schema.xml')
# copy the schema.xml into the proper directory
local('cp schema.xml /usr/local/Cellar/solr/3.6.0/libexec/example/solr/conf/schema.xml')
# start the solr server
local('cd /usr/local/Cellar/solr/3.6.0/libexec/example && java -jar start.jar')
Note: you can run these commands on the command line if you dont use fabric
I had the same issue, the rebuild task failed. For me the solution was:
Build a new schema.xml and place it in the corresponding folder
Restart Solr
rebuild the index without problems
I am running my django app on heroku. I want to use their websolr plugin to add spatial search to the app via django haystack.
Spatial serach in django haystack depends on the GEOS C library that is not deployed on heroku by default.
So in order to use spatial search I followed https://devcenter.heroku.com/articles/buildpack-binaries to create a binary package of GEOS.
To deploy the binaries I forked the heroku buildback for python and modified bin/compile to include:
AWESOME_VM_BINARY="http://vulcan-dtornow.herokuapp.com/output/05391114-f314-4aa7-9aab-bc09025d4898"
mkdir -p /app/.heroku/vendor/geos
curl $AWESOME_VM_BINARY -o - | tar -xz -C /app/.heroku/vendor/geos -f -
I added the custom build pack to my application, redeployed but still I cannot access the library. When I run ls the geos folder does not show up
heroku run ls /app/.heroku/vendor
Any idea what I am missing? Thanks for your help!
Another option is using a buildpack that only contains the geospatial libraries and combine it with the python buildpack. This is a cleaner separation:
https://github.com/cyberdelia/heroku-geo-buildpack/
in combination with
https://github.com/heroku/heroku-buildpack-multi
To use it add a .buildpacks file to your repo that looks something like this
https://github.com/cyberdelia/heroku-geo-buildpack.git
https://github.com/heroku/heroku-buildpack-python.git
(the use of multi buildpacks is explained in the multi buildpack repo as well)
You should be able to use the GeoDjango buildpack that was already created here
I have a custom admin command named temperature.py which is under /home/user/project/monitor/management/commands. If I change directory to /home/user/ and execute:
user#localhost:~/project$ ./manage.py temperature
It runs ok, and its listed in the available commands. But if I try running it with the absolute path:
user#localhost:/$ /home/user/project/manage.py temperature
It says the command does not exist, it does not show up in the available commands either. I have django 1.2.1 with python 2.6.5 in ubuntu 10.04. Could this be a problem with django? is it the python version? Thanks in advance
Found the reason, it seems that django is looking for the settings under the main directory, if it fails to find one, it will use the defaults. You can change your python path or use this in your manage.py file