Code Monkey home page Code Monkey logo

Comments (13)

bernardopires avatar bernardopires commented on September 23, 2024

Hi Brad,

many thanks for your input! Your experience is for sure much appreciated, feel free to post it here.
I'm not familiar with buildout, could you please tell me where I have to add unzip = True?

I've added psycopg2 to the dependencies and will take a look at SHARED_APPS and TENANT_APPS right now.

Don't hesitate to post any problems you have. Thanks again!

Bernardo

from django-tenant-schemas.

humbled avatar humbled commented on September 23, 2024

Hi Bernado

Good timing, was just about to give up for the night!

The unzip=true will be familiar to any buildout users, but it goes in the main [buildout] section of buildout.cfg.

Problem right now is trying to get one app visible - I have "No Client matches the given query.". I tried setting up the admin app as an initial one (new project) but that didn't seem to work with this out of the box so I'm stepping back and creating an app. Unless it should just work and I have something wrong?

from django.conf.urls.defaults import patterns, include

from django.contrib import admin
from tenant_schemas.templatetags.tenant import url

# Find the admin site for the settings.INSTALLED_APPS
admin.autodiscover()

urlpatterns = patterns('',
    # Enables the admin interface
    (r'^admin/', include(admin.site.urls)),

)

url: http://localhost:8000/admin

result: No Client matches the given query. on 404 page

Any thoughts, or continue down make-an-app route?

Thanks
Brad

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

Hi Brad,

do you have a tenant model? If not, the first step is creating one. After
that, to get localhost:8000 to work you'll need to add it as a tenant using
the public schema. Take look at
https://django-tenant-schemas.readthedocs.org/en/latest/install.html and
https://django-tenant-schemas.readthedocs.org/en/latest/use.html for more
information. I hope this helps!

Bernardo

2013/3/16 humbled [email protected]

Hi Bernado

Good timing, was just about to give up for the night!

The unzip=true will be familiar to any buildout users, but it goes in the
main [buildout] section of buildout.cfg.

Problem right now is trying to get one app visible - I have "No Client
matches the given query.". I tried setting up the admin app as an initial
one (new project) but that didn't seem to work with this out of the box so
I'm stepping back and creating an app. Unless it should just work and I
have something wrong?

from django.conf.urls.defaults import patterns, include
from django.contrib import adminfrom tenant_schemas.templatetags.tenant import url

Find the admin site for the settings.INSTALLED_APPSadmin.autodiscover()

urlpatterns = patterns('',
# Enables the admin interface
(r'^admin/', include(admin.site.urls)),
)

url: http://localhost:8000/admin

result: No Client matches the given query. on 404 page

Any thoughts, or continue down make-an-app route?

Thanks
Brad


Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-15001681
.

Bernardo Pires Carneiro

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

By the way, I must be blind but I can't find any file named buildout.cfg in
my project? To be honest I don't even remember I was supporting it

2013/3/16 Bernardo Carneiro [email protected]

Hi Brad,

do you have a tenant model? If not, the first step is creating one. After
that, to get localhost:8000 to work you'll need to add it as a tenant using
the public schema. Take look at
https://django-tenant-schemas.readthedocs.org/en/latest/install.html and
https://django-tenant-schemas.readthedocs.org/en/latest/use.html for more
information. I hope this helps!

Bernardo

2013/3/16 humbled [email protected]

Hi Bernado

Good timing, was just about to give up for the night!

The unzip=true will be familiar to any buildout users, but it goes in the
main [buildout] section of buildout.cfg.

Problem right now is trying to get one app visible - I have "No Client
matches the given query.". I tried setting up the admin app as an initial
one (new project) but that didn't seem to work with this out of the box so
I'm stepping back and creating an app. Unless it should just work and I
have something wrong?

from django.conf.urls.defaults import patterns, include
from django.contrib import adminfrom tenant_schemas.templatetags.tenant import url

Find the admin site for the settings.INSTALLED_APPSadmin.autodiscover()

urlpatterns = patterns('',
# Enables the admin interface
(r'^admin/', include(admin.site.urls)),
)

url: http://localhost:8000/admin

result: No Client matches the given query. on 404 page

Any thoughts, or continue down make-an-app route?

Thanks
Brad


Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-15001681
.

Bernardo Pires Carneiro

Bernardo Pires Carneiro

from django-tenant-schemas.

humbled avatar humbled commented on September 23, 2024

First re buildout - it's a build mechanism you can use for any project. It's supported for django through django-recipe. Don't worry about documenting it for now, I can give you an end-to-end for this later as an optional aside on your wiki if you want. Actually I'll put it on my blog and send you then link and you can do what you like with it

from django-tenant-schemas.

humbled avatar humbled commented on September 23, 2024

Re my current setup, I should have said sorry that I have public and tenant1 schemas as per the wiki pages. My schemas look like:

Screen Shot 2013-03-16 at 10 04 11 PM

My tenant is:

from django.db import models
from tenant_schemas.models import TenantMixin

class Client(TenantMixin):
    name = models.CharField(max_length=150)
    short_name = models.CharField(max_length=15)
    on_trial = models.BooleanField()
    created_on = models.DateField(auto_now_add=True)

    # default true, schema will be automatically created and synced when it is saved
    auto_create_schema = True

Thanks!

from django-tenant-schemas.

humbled avatar humbled commented on September 23, 2024

My proj structure:
Screen Shot 2013-03-16 at 10 06 32 PM

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

Well, that's awkward that it still doesn't find any clients. Can you show me the rows on your client table? You should have a row where domain_url is localhost

from django-tenant-schemas.

humbled avatar humbled commented on September 23, 2024

Ha! That got me further. I had blindly put in my domain for public as my-domain.com as per the Use page on the wiki. Seems obvious now but when starting fresh you do a lot of copy-paste.

Thanks, I'll see how far that gets me

Oh and one more thing, I presume urls.py etc should use from tenant_schemas.templatetags.tenant import url instead of django default? I didn't see this explicitly in the docs

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

Oh glad it's working now then, I'll update the docs to use localhost for
the public schema. And on urls.py there's no problem to use the django
version of url.

2013/3/16 humbled [email protected]

Ha! That got me further. I had blindly put in my domain for public as
my-domain.com as per the Use page on the wiki. Seems obvious now but when
starting fresh you do a lot of copy-paste.

Thanks, I'll see how far that gets me

Oh and one more thing, I presume urls.py etc should use from
tenant_schemas.templatetags.tenant import url instead of django default?
I didn't see this explicitly in the docs


Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-15001934
.

Bernardo Pires Carneiro

from django-tenant-schemas.

humbled avatar humbled commented on September 23, 2024

Thanks. Getting there.

A recommended project structure section on the Install page would be awesome. It seems you have something like:

myapp/
    customers/
    myapp/
        hotels/
            views.py
            models.py
            urls.py
        houses/
            views.py
            models.py
            urls.py
        settings.py
        urls.py
        public_urls.py
        tenant_urls.py

My management app (equivalent of customers) is living under myapp currently as it seems a bit funny having it outside of settings.py etc's parent. Though I'm no expert and I may have interpreted your structure wrongly

from django-tenant-schemas.

humbled avatar humbled commented on September 23, 2024

Hi Bernardo

Site is now working quite nicely, except for some strangeness around urls

I'm using

urlpatterns = patterns('',
   url(r'^main/', include('client_webapp.public_urls')),

because

urlpatterns = patterns('',
    url(r'^main/$', 'your_project.public_urls'),

from the docs wouldn't work for me (my understanding is without the include wrapper it is looking for a view) and I get exception:

ViewDoesNotExist at /main/admin/
Could not import client_webapp.public_urls. View does not exist in module client_webapp.

But with this current setup, main/ is getting prepended to all my urls, in links and the address bar once navigated, for both the public and tenant domains. (NB to get tenant domain working locally I set up a hosts file entry 127.0.0.1 tenant1

Your input appreciated
Thanks
Brad

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

Hi Brad,

You don't need the URL public token (main) for your tenants. You only use
it if you want to be able to serve different views at the same URL (for
example two different views at /, depending if on a tenant or on the public
schema). If you start using the token, don't forget to edit settings
appropriately and to use the url and reverse commands that ship with
this app. This section on the docs might help you:
https://django-tenant-schemas.readthedocs.org/en/latest/install.html#tenant-view-routing

If you have any further questions don't hesitate in asking!

Cheers,
Bernardo

2013/3/21 humbled [email protected]

Hi Bernardo

Site is now working quite nicely, except for some strangeness around urls

I'm using

urlpatterns = patterns('',
url(r'^main/', include('client_webapp.public_urls')),

because

urlpatterns = patterns('',
url(r'^main/$', 'your_project.public_urls'),

from the docs wouldn't work for me (my understanding is without the
include wrapper it is looking for a view) and I get exception:

ViewDoesNotExist at /main/admin/
Could not import client_webapp.public_urls. View does not exist in module client_webapp.

But with this current setup, main/ is getting prepended to all my urls, in
links and the address bar once navigated, for both the public and tenant
domains. (NB to get tenant domain working locally I set up a hosts file
entry 127.0.0.1 tenant1

Your input appreciated
Thanks
Brad


Reply to this email directly or view it on GitHubhttps://github.com//issues/40#issuecomment-15225246
.

from django-tenant-schemas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.