Thank you Andréas. I have come across that too, after my OT.

This is definitely what I was looking for.

cheers

On 4/9/20 2:05 AM, Andréas Kühne wrote:
Hi Tim,

What you probably should do is use a custom command on the manage.py command interface. You till then get access to all of djangos goodness - and it can be run from the command line.

See here:
https://docs.djangoproject.com/en/3.0/howto/custom-management-commands/

This is how I would handle it.

Regards,

Andréas


Den tors 9 apr. 2020 kl 00:18 skrev Tim Johnson <t...@akwebsoft.com <mailto:t...@akwebsoft.com>>:

    using django.VERSION (2, 1, 5, 'final', 0) with

    python 3.7.2 on ubuntu 16.04

    I have a need for a "Housekeeping" application. It's usage would be to

    1) connect to a database, either mysql, mariadb or postgres

    2) truncate two tables and repopulate them based on an arbitrary data
    structure such as a compound list or tuple.

    Such an application would not need be and most preferably should
    not be
    part of a deployed website.

    This should not be a very complicated endeavor. The simplest method
    might be to manually establish an ORM connection using settings.py to
    import the connection credentials. I am wondering if this is possible.

    However, I am unable to find documentation that would edify me on
    manually coding an ORM connection and clearing a database without the
    loading of django resources.

    If such an approach is feasible, I would welcome URLs to appropriate
    documentation and/or discussion.

    Using a model-view approach would be the simplest method, I would
    think,
    but there would be no need to have such a view deployed. There is
    probably a solution that would necessitate installing a custom
    package
    to be used from manage.py, such as
    https://github.com/KhaledElAnsari/django-truncate and that might be
    complicated.

    Comments are welcome

    thanks

-- Tim
    tj49.com <http://tj49.com>

-- You received this message because you are subscribed to the Google
    Groups "Django users" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to django-users+unsubscr...@googlegroups.com
    <mailto:django-users%2bunsubscr...@googlegroups.com>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/django-users/4be7c6fc-d99e-7419-24ef-d54cbdf384d4%40akwebsoft.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com <mailto:django-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCdSf%2BJ9ZufHavQqv-9ftOkOUwNODsFd-w6QQmzzK61j5Q%40mail.gmail.com <https://groups.google.com/d/msgid/django-users/CAK4qSCdSf%2BJ9ZufHavQqv-9ftOkOUwNODsFd-w6QQmzzK61j5Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
Tim
tj49.com

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/35392bf4-d25a-95d6-fb32-bf09fd01e997%40akwebsoft.com.

Reply via email to