incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Deibert <mark.deib...@gmail.com>
Subject Re: Having troubles with rewrites
Date Tue, 08 Oct 2013 12:01:16 GMT
Hey Stanley :-)

Thanks for the advice and for a normal, CouchDB only setup, you're info is
correct. However, with a Couchapp, it works a bit different. You have to
setup the rewrites.js(json) file in your Couchapp directory structure and
then it pushes the rewrite property to a specific doc in CouchDB. So the
rewrites property is on the correct document. I _think_ my problem is in my
paths. Either the vhosts, or in the rewrite "from" and/or the "to". I was
hoping some here is using rewrites and would notice something in my
provided code.

Also, I keep "services" open the background restart Couch after nearly
every change. When you change one of the ini's, you have to.

Thanks again for your help :-)

Mark



On Mon, Oct 7, 2013 at 9:24 PM, Stanley Iriele <siriele2x3@gmail.com> wrote:

> I'm in a movie but you need the full path to the rewrites section..also
> your rewrites path is wrong..it should be
> rednecks/_design/rednecks/_rewrites..And your rewrites.json file should be
> in that place in your design doc ..just to be safe restart your database...
> Via _restart...hope that helps
> On Oct 7, 2013 5:01 PM, "Mark Deibert" <mark.deibert@gmail.com> wrote:
>
> > Ok so now I've added a rewrites.js file to my Couchapp root folder. In
> this
> > js file I have...
> >
> > [
> >    {
> >        "method": "GET",
> >        "from": "/home",
> >        "to": "app/index.html",
> >    }
> > ]
> >
> >
> > Now when I push the Couchapp, in CouchDB in my _design/rednecks I see
> it's
> > creating a "rewrites" property with the above js. So this looks all good
> to
> > me. This is how to do this right?
> >
> > I changed my local.ini vhost to...
> >
> > [vhosts]
> > rnr.couchdb:5984 = /rednecks/_design/rednecks
> >
> >
> > In Chrome I enter url...
> >
> > http://rnr.couchdb:5984/home
> >
> > I get same error...
> >
> > {"error":"not_found","reason":"Document is missing attachment"}
> >
> >
> > That index.html attachment is absolutely there. I can see it. The app
> > runs fine if I disable this rewrite garbage. I've tried every
> > variation of the "to" string that I can think of and all I see is that
> > same error above.
> >
> > Does _anyone_ know how to do this?!?!?!....
> >
> >
> >
> >
> > On Mon, Oct 7, 2013 at 6:47 PM, Mark Deibert <mark.deibert@gmail.com>
> > wrote:
> >
> > > I have Couchapp. It's working fine. Today, sadly, I decided to try
> > > rewrites. I'm having a good bit of trouble with this. Docs offer very
> > > minimal help. Not sure where my gears are stuck.
> > >
> > > Here is my local.ini vhosts entry...
> > >
> > > [vhosts]
> > > rnr.couchdb:5984 = /rednecks/_design/_rewrites
> > >
> > >
> > > I created a _design/_rewrites doc in the rednecks db. Here is it's
> > > content...
> > >
> > > {
> > >    "_id": "_design/_rewrites",
> > >    "_rev": "8-1cd78f53e0b21331bc9f9d8d33d1725b",
> > >    "rewrites": [
> > >        {
> > >            "from": "home",
> > >            "to": "/_design/rednecks/app/index.html",
> > >            "method": "GET",
> > >            "query": {
> > >            }
> > >        }
> > >    ]
> > > }
> > >
> > >
> > > In Chrome I enter http://rnr.couchdb:5984/home and I get this error...
> > > {"error":"not_found","reason":"Document is missing attachment"}
> > >
> > >
> > > It seems to me that the "to" in the rewrite is not finding the design
> > doc and it's attachment. That doc definitely does exist because the app
> > runs great if I turn off the rewrite and just enter the full ugly path.
> > >
> > > The _design/rednecks and the _design/_rewrites docs are in the same
> > path/folder in Couch. The info in docs.couchdb.org, section 3.7 is very
> > light. It doesn't even mention how the "to" path is figured. From what
> path
> > does it start? No mention of that. Nice docs. In the CouchDB Wiki,
> they've
> > cut/pasted the same documentation and added almost zero additional info.
> > Someone did attempt to add the "to" path info at the bottom, but it's not
> > really English that I can understand. So that's not helpful.
> > >
> > > So... I'm hoping someone here can help me get unstuck :-)
> > >
> > > Thanks for any advice,
> > >
> > > Mark
> > >
> > >
> > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message