How to Install Solr to use with Haystack in Django - django

I'm installing Solr to be used with Haystack / Django.
How do I go about installing Solr? Do I need to follow the online instructions exactly and install services like Tomcat?

The above questions I just commented make all the difference if you are set on installing / setting this up yourself. OR you could use a hosted service (read: easy).
Try out http://websolr.com I'm loving it.
If you are on OSX and want a local Solr instance just to try out for some development, this is an awesome tutorial: http://realityloop.com/blog/2011/07/19/setting-multicore-apache-solr-os-x-using-homebrew
essentially brew install solr, and then some configuration.
If you are trying to do a production level solr server on a linux operating system, I would suggest working with an instruction set specific to that distribution and the version you are using. OR even better, bite the bullet and pay someomne who knows what they are doing to set it up (make sure your indexes won't fail or go down).

Related

Step by Step install of wso2 EMM for Ubuntu

I've visited the wso2 website and the install instructions are very disjointed in that there is a lot of jumping around between pages. I've seen the following blog that seemed to streamline the instructions but it doesn't seem complete (plus it's out of date with the version it's installing) - https://maxmalm.se/blog/2014-06-17-installing-wso2-enterprise-mobility-manager-110
Has anyone seen step-by-step instructions on what needs to be done to completely setup wso2-EMM on a newly installed Ubuntu 14.04 virtual machine with just the O/S on it and none of the pre-reqs installed yet? The blog I mentioned above seems to give a lot of the necessary apt-get install bits but doesn't mention anything about a database (yet the wso2 has a whole section on installing and using a database).
Thank you.
To try out WSO2 EMM you will only need to have JDK 7 or 8 [1] installed as minimum to start off the server. WSO2 products are build to run with OOB database which is H2. So to get things started and play around, I suggest that you install java and then start the pack to get things going.
[1] https://docs.wso2.com/display/EMM201/Installing+on+Linux+or+OS+X
To getting started all you need is JDK installed in your machine and setting the Java related environment variables like PATH, JAVA_HOME. You might have to install the correct version of JDK for the particular version of the EMM.

Unable to download distribution package for Django

I'm currently testing with a django web application using version 1.6 with a python version 3.4.1 and needs to install some packages here on my machine. Based from what I've observed we are currently connected to a proxy server which is why I'm having issues downloading some of it. Below are the actions that I've taken so far.
1) I've updated my http_proxy connection to http://innoproxy:8083/proxy.pac which is our current proxy connection.
2) Below is error that mostly occurs when I would install the South Package.
C:\Users\fx0.MANDAUE>pip install South
Downloading/unpacking South
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement South
Cleaning up...
No distributions at all found for South
Storing debug log for failure in C:\Users\fx0.MANDAUE\pip\pip.log
My question is, would it be possible for me to install that package without using the command prompt(manual download) or do I still lack some actions from my end for the downloading to work? I've already checked other possible solutions but so far to no avail. Thanks!
I'm in a similar situation behind my corporate proxy. You may first want to check whether your proxy is looking for authentication, in which case setting you connection string to http://username:password#proxyserver:port/ may help. In my case, however, our authentication relies on Windows Active Directory, which I've yet to overcome on my Linux box.
If all else fails, as in my case, you can manually download the source tar.bz (or similar compressed directory) from PyPI and use pip install path/to/source. This will mean manually downloading all dependencies and installing them the same way. It can be a pain, but it works.

Fabric + buildout as opposed to Fabric + pip + virtualenv

I've recently started playing around with Mezzanine, a django-based CMS. I recently just managed to configure Fabric to get it uploading to my host, webfaction.com, as its a bit more involved automatically creating the website on the shared hosting, and I wanted to automate that process.
Altogether, that system uses Fabric for template uploads of config files, and pip + virtualenv for handling the python packages.
However, I just recently read about buildout, and how some people swear by it for deployment, and others don't. See here: Django remote deployment with buildout and Fabric and here: http://labs.creativecommons.org/2011/07/29/not-panicking-switching-to-virtualenv-for-deployment/
While I've googled and found a ton of results for buildout vs. pip, there's not much information about buildout + fabric vs. pip + fabric. It seems like some of the features of buildout (uploading config templates, handling supervisor) can be done through fabric. Can someone tell me the advantages and disadvantages of either approach?
Note: As I'm using shared hosting for the foreseeable future, I can't sudo, which it seems buildout may require for a number of existing recipes.
Summary: Pip only installs python packages and there's more you need to do, obviously. You can do most of the extra work in buildout with the advantage that buildout does it for you both locally and on the server. Fabric has to do less, that way. The drawback is buildout's extra complexity, so if a couple of custom fabric commands is enough for you, that might be preferable for you. So: how does the trade-off work for you?
The long version:
Pip is good at installing python packages for your project. Buildout is good at setting up almost everything for a project (including python packages). That's the difference in goals.
Now... you bring fabric into the mix. With pip+fabric, you can call pip from within fabric to grab all the python packages and then you use fabric itself to set up everything else. An apache/nginx config file, creation of a couple of directories ("var/log/"), etc.
With buildout+fabric, you'll have configured buildout already to do a lot of the things like creating directories and generating files from templates and setting up supervisor and setting up a cronjob to fire up supervisor upon #reboot. So the fabfile has to do less.
So... you swap responsibilities. Everything you can do in buildout, you can do in fabric. Everything you can do in buildout, you can do with custom python (or shell) scripts in combination with pip ("read the README for the extra commands you have to do").
Buildout is a good place to do things if it is an integral part of your project. Think about it like this: if you need it both in production on the server and locally on your development machine, you're better off doing it in buildout. Otherwise you have to run fabric on your local machine, too. You can do it, but...
I use fabric in combination with buildout, myself. Buildout is for setting up the project itself, fabric for everything around it. Some examples:
Actually cloning the buildout from git on the production server.
Git pull (and checkout of the proper tag).
Restarting supervisor.
My suggestion: look on pypi for buildout recipes to see if they are handy for you. Do they save you enough work to make it worthwhile to dive into the extra complexity that a full buildout configuration means? If you don't get enough out of buildout, you might be better off with just fabric+pip and a bunch of custom commands in your fabric file.
Take a look at fabtools which adds a lot of nice buildout functionality into your fabfile. I've worked with all sorts, Chef, Puppet (sledgehammer for a walnut) Ansible and Fabric. I find Ansible great for devops teams who are stuck, but don't want to learn a language, but personally, a well organised Fabric project wins hands down.

Django on Mac OS X requires install of MySQLdb

I tried setting up Django to use a MySQL database and it choked because the backend was not available. Reading around the net I see that MySQLdb needs to be installed, and perhaps _mysql needs to be installed as well. I have been surprised that so many different sets of instructions are available, which all seem to do different things in the install process. There are also a large number of posts about the problems with installing MySQLdb, and frequent comments about the install being a PIA. This gives me pause, as I imagine that arbitrary choices which I may make may cause random and hard to track down bugs.
Is there a consensus on what the most reliable install method is?
I don't mind configuration issues. I'm just hoping not to create original problems. As a general rant, with MySQL being so common of a DBMS, why isn't the backend already installed in Django?
I use Homebrew to install stuff like MySQL. It's pretty simple:
Install Homebrew:
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
Install MySQL using Homebrew:
brew install mysql
Install the MySQL Python module using your preferred Python installation mechanism (I prefer using Pip):
pip install MySQL-python
As a general rant, with MySQL being so common of a DBMS, why isn't the backend already installed in Django?
You can use other database backends with Django (SQLite or PostgreSQL, for example), and the MySQL connector itself is a module installed outside of Django (and potentially used by other software -- it many cases it might already be installed).

Producing a WAR file from a django project with SQLite

I have a django project (a django module/app some other modules that are used from the django one) that uses SQLite. This project is for a University course and now I am asked to supply it in such a way so that it may be installed on some server in our faculty. I'm not the one who's going to install it, and I will not be contacted in case of failure, so I am looking for the easiest, simplest way to supply the project for installation.
I have come across django-jython which supposedly allows one to create WAR files from django projects. However, in the Database Backends section, it says:
SQLite3
Experimental. By now, use it only if you are working on improving it. Or if you are really adventurous.
My overall goal is to deliver this project and I would appreciate any helpful advice. In particular:
Is there another way to pack a django project into a WAR file that supports SQLite?
Is it safe to use SQLite with django-jython in spite of this warning? If so, then how?
Is there any other simple way to pack a django project so that it'll be a piece of cake to install?
If the above answers are "no", then what does it take to change the configuration of the project to use MySQL instead?
You should look into Fabric for easy deployment. I haven't used it myself, but I've heard good things.
I've also had good success quickly and easily setting up servers using Gunicorn with Nginx as a reverse-proxy.
As others have said, using virtualenv, with pip, can quickly
get all your dependencies installed via requirements.txt (from virtualenv).
Some of these blog posts may help:
Tools of the modern Python hacker - virtualenv, pip, fabric
Basic Django Deployment - virtualenv, pip, fabric, rsync
Easy Django Deployment - very quick nginx and gunicorn setup
Edit:
As I reread your post I saw your last bullet point/question. Django is designed to be loosely coupled, meaning that there shouldn't (in most cases) be reasons that one app is dependant on sqlite vs mysql. If you don't need to save the data in the db, changing to MySQL is as easy as starting a mysql server on your machine, and changing the settings.py of your django project. This SO question may help