Coder Social home page Coder Social logo

Comments (6)

graingert avatar graingert commented on June 16, 2024

reproduction: https://pyfiddle.io/fiddle/af018023-317c-4460-9d76-9e40621f3def/?i=true

turns out pyfiddle doesn't support sqlite3 so you'll have to copy it into your codebase

from django-micro.

maxpoletaev avatar maxpoletaev commented on June 16, 2024

Thank you for reporting.  I’ll look into it.

from django-micro.

graingert avatar graingert commented on June 16, 2024
import django_micro
from django.http import HttpResponse
from django.db import models

django_micro.configure({
    'DEBUG': True,
    'DATABASES': {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': ':memory:'
        },
    },
})

@django_micro.route('', name='homepage')
def homepage(request):
    name = request.GET.get('name', 'World')
    return HttpResponse('Hello, {}!'.format(name))


class Post(models.Model):
    title = models.CharField(max_length=255)
    parent = models.ForeignKey('self', null=True, on_delete=models.CASCADE)

    class Meta:
        app_label = django_micro.get_app_label()


from django.core import management

@django_micro.command('print_hello')
class PrintHelloCommand(management.BaseCommand):
    def handle(self, *args, **options):
        management.call_command('makemigrations', django_micro.get_app_label())
        management.call_command('migrate', run_syncdb=True)
        p = Post.objects.create(title='foo')
        Post.objects.create(parent=p, title='ham')
        print(
            Post
            .objects
            .values_list('parent__title', 'title')
        )


application = django_micro.run()

from django-micro.

graingert avatar graingert commented on June 16, 2024

also interestingly omitting the django_micro.get_app_label() in the makemigrations command means it django doesn't find any changes

from django-micro.

graingert avatar graingert commented on June 16, 2024

@ZenWalker okay I've managed to get sqlite working on pyfiddle: https://pyfiddle.io/fiddle/f5a6361a-49df-4c79-8d3c-f94cadb94b6a/

from django-micro.

maxpoletaev avatar maxpoletaev commented on June 16, 2024

Fixed in 1.7.1 🎉

from django-micro.

Related Issues (12)

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.