Code Monkey home page Code Monkey logo

Comments (7)

jschrewe avatar jschrewe commented on July 2, 2024

Well, the problem here is that mongoadmin runs fine without any relational db as long as it is set to

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.dummy'
    }
}

The only problem is that the admin tends to use contenttypes all over the place. So in order to make the admin run without any kind of relational db mongoadmin tries to figure out if there is a relational db and if there isn't then uses the contenttypes provided by mongoengine. I think the auth system needs them at least.

I do very much agree though that the current test for a relational db sucks and I'd love to have a better (and more robust) test. I do remember that just catching every error the database might throw makes running syncdb next to impossible. Ah, well seems I need to figure out a better test now.

If you can tell jenkins to just catch and ignore it you should be fine though (maybe set HAS_RELATIONAL_DB to False too).

from django-mongoadmin.

Karmak23 avatar Karmak23 commented on July 2, 2024

Correct me if I'm wrong, but I feel like setting the default database engine to dummy will imply the same for the test database ? It is obviously not what we want, but I will investigate this on my side.

I tend to think the same about HAS_RELATIONAL_DB In fact, we have a relational db, but only for the tests.

from django-mongoadmin.

jschrewe avatar jschrewe commented on July 2, 2024

I have no idea but I suppose you'll get the same for tests. And, well, I can't tell you what you want of course, only the state the code is in. Which isn't all that great apparently.

And the only reason HAS_RELATIONAL_DB is there is because it didn't really work for me without. I'm a bit amazed that you got it working without any relational db.

But I take a look at it tomorrow and hopefully come up with a better way to test this.

from django-mongoadmin.

jschrewe avatar jschrewe commented on July 2, 2024

Give d5633d2 a try. If you add MONGOADMIN_CHECK_CONTENTTYPE = False to settings.py it should not try to figure out wether a relational db is there or not. I'd actually like to make the real test more robust, but failed miserably. So I hope this works for you too.

from django-mongoadmin.

Karmak23 avatar Karmak23 commented on July 2, 2024

Latest commit works, regarding this issue, on my already setup project.

The subsequent question is: is there a way to simply delay this test, like with a *_lazy() function ? Because the crash still arise when I start a Django project from scratch.

The main problem beiing that even with a relational database and everything correctly configured, ./manage createdb will fail because the ContentType model has not created the SQL table yet. This happens a lot in our environment, either in Jenkins which always start from scratch to be sure the project is completely installable at any time, or when (re-)deploying a full preview environment to test new features.

I understand that I can either temporarily remove mongoadmin from INSTALLED_APPS or define MONGOADMIN_CHECK_CONTENTTYPE = False until createdb is done, but this is still awkward: you would have to document somewhere that any project starting from scratch with mongoadmin included will fail to start, and provide these 2 possible workarounds.

from django-mongoadmin.

jschrewe avatar jschrewe commented on July 2, 2024

Aww, I thought createdb would run without issue and the problem was that Jenkins just didn't create a database. I do wonder if there is a pattern I'm missing that runs tests like this only once but later.

Thinking a bit more about this I think looking at the database setting and assuming that the ContentType stuff only needs replacement if the DB is explicitly set to dummy is the way to go. This is how it works at the moment anyway. Only uglier...

from django-mongoadmin.

Karmak23 avatar Karmak23 commented on July 2, 2024

I close this issue because I didn't have time to test further this particular config. I will reopen it if I hit the bug again.

from django-mongoadmin.

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.