How to write a script that does collectstatic for django












4















I want to do an automatic collectstatic script for my django application. I tried various things but it did not work. My last attempt is to call an expect script within a normal script:



collectstatic.sh:



python manage.py collectstatic --settings=app.settings_mark &&
./testscript.sh


testscript.sh:



#!/usr/bin/expect -f
spawn testscript.sh
expect "Type 'yes' to continue, or 'no' to cancel:"
send "yes"


However, the line ./testscript.sh get never executed because the collectstatic command before is waiting for input. How can I skip that ? I also tried leaving out the && but it didn't work.



Thanks in advance !










share|improve this question























  • It seems to me this question should be at StackOverflow...

    – Alexandre
    Nov 29 '15 at 5:47











  • no cause it is clearly a shell script question, all the others questions regarding shell/bash are on askubuntu as well, thanks for watching though !

    – Paul Bernhard Wagner
    Nov 29 '15 at 5:56


















4















I want to do an automatic collectstatic script for my django application. I tried various things but it did not work. My last attempt is to call an expect script within a normal script:



collectstatic.sh:



python manage.py collectstatic --settings=app.settings_mark &&
./testscript.sh


testscript.sh:



#!/usr/bin/expect -f
spawn testscript.sh
expect "Type 'yes' to continue, or 'no' to cancel:"
send "yes"


However, the line ./testscript.sh get never executed because the collectstatic command before is waiting for input. How can I skip that ? I also tried leaving out the && but it didn't work.



Thanks in advance !










share|improve this question























  • It seems to me this question should be at StackOverflow...

    – Alexandre
    Nov 29 '15 at 5:47











  • no cause it is clearly a shell script question, all the others questions regarding shell/bash are on askubuntu as well, thanks for watching though !

    – Paul Bernhard Wagner
    Nov 29 '15 at 5:56
















4












4








4








I want to do an automatic collectstatic script for my django application. I tried various things but it did not work. My last attempt is to call an expect script within a normal script:



collectstatic.sh:



python manage.py collectstatic --settings=app.settings_mark &&
./testscript.sh


testscript.sh:



#!/usr/bin/expect -f
spawn testscript.sh
expect "Type 'yes' to continue, or 'no' to cancel:"
send "yes"


However, the line ./testscript.sh get never executed because the collectstatic command before is waiting for input. How can I skip that ? I also tried leaving out the && but it didn't work.



Thanks in advance !










share|improve this question














I want to do an automatic collectstatic script for my django application. I tried various things but it did not work. My last attempt is to call an expect script within a normal script:



collectstatic.sh:



python manage.py collectstatic --settings=app.settings_mark &&
./testscript.sh


testscript.sh:



#!/usr/bin/expect -f
spawn testscript.sh
expect "Type 'yes' to continue, or 'no' to cancel:"
send "yes"


However, the line ./testscript.sh get never executed because the collectstatic command before is waiting for input. How can I skip that ? I also tried leaving out the && but it didn't work.



Thanks in advance !







command-line bash scripts expect






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 29 '15 at 5:18









Paul Bernhard WagnerPaul Bernhard Wagner

2152511




2152511













  • It seems to me this question should be at StackOverflow...

    – Alexandre
    Nov 29 '15 at 5:47











  • no cause it is clearly a shell script question, all the others questions regarding shell/bash are on askubuntu as well, thanks for watching though !

    – Paul Bernhard Wagner
    Nov 29 '15 at 5:56





















  • It seems to me this question should be at StackOverflow...

    – Alexandre
    Nov 29 '15 at 5:47











  • no cause it is clearly a shell script question, all the others questions regarding shell/bash are on askubuntu as well, thanks for watching though !

    – Paul Bernhard Wagner
    Nov 29 '15 at 5:56



















It seems to me this question should be at StackOverflow...

– Alexandre
Nov 29 '15 at 5:47





It seems to me this question should be at StackOverflow...

– Alexandre
Nov 29 '15 at 5:47













no cause it is clearly a shell script question, all the others questions regarding shell/bash are on askubuntu as well, thanks for watching though !

– Paul Bernhard Wagner
Nov 29 '15 at 5:56







no cause it is clearly a shell script question, all the others questions regarding shell/bash are on askubuntu as well, thanks for watching though !

– Paul Bernhard Wagner
Nov 29 '15 at 5:56












2 Answers
2






active

oldest

votes


















5














Why not just send yes to the input of manage.py:



python manage.py collectstatic --settings=app.settings_mark <<<yes &&
./testscript.sh


Or:



echo yes | python manage.py collectstatic --settings=app.settings_mark &&
./testscript.sh





share|improve this answer
























  • works ! great, thank you ! nice hack!

    – Paul Bernhard Wagner
    Nov 29 '15 at 22:08






  • 2





    You can accomplish the same thing with the noinput arg: manage.py collectstatic --noinput stackoverflow.com/questions/8705305/…

    – ptevans
    Nov 4 '16 at 0:34





















1














You can try



python manage.py collectstatic --noinput





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f703762%2fhow-to-write-a-script-that-does-collectstatic-for-django%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    Why not just send yes to the input of manage.py:



    python manage.py collectstatic --settings=app.settings_mark <<<yes &&
    ./testscript.sh


    Or:



    echo yes | python manage.py collectstatic --settings=app.settings_mark &&
    ./testscript.sh





    share|improve this answer
























    • works ! great, thank you ! nice hack!

      – Paul Bernhard Wagner
      Nov 29 '15 at 22:08






    • 2





      You can accomplish the same thing with the noinput arg: manage.py collectstatic --noinput stackoverflow.com/questions/8705305/…

      – ptevans
      Nov 4 '16 at 0:34


















    5














    Why not just send yes to the input of manage.py:



    python manage.py collectstatic --settings=app.settings_mark <<<yes &&
    ./testscript.sh


    Or:



    echo yes | python manage.py collectstatic --settings=app.settings_mark &&
    ./testscript.sh





    share|improve this answer
























    • works ! great, thank you ! nice hack!

      – Paul Bernhard Wagner
      Nov 29 '15 at 22:08






    • 2





      You can accomplish the same thing with the noinput arg: manage.py collectstatic --noinput stackoverflow.com/questions/8705305/…

      – ptevans
      Nov 4 '16 at 0:34
















    5












    5








    5







    Why not just send yes to the input of manage.py:



    python manage.py collectstatic --settings=app.settings_mark <<<yes &&
    ./testscript.sh


    Or:



    echo yes | python manage.py collectstatic --settings=app.settings_mark &&
    ./testscript.sh





    share|improve this answer













    Why not just send yes to the input of manage.py:



    python manage.py collectstatic --settings=app.settings_mark <<<yes &&
    ./testscript.sh


    Or:



    echo yes | python manage.py collectstatic --settings=app.settings_mark &&
    ./testscript.sh






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 29 '15 at 6:11









    murumuru

    1




    1













    • works ! great, thank you ! nice hack!

      – Paul Bernhard Wagner
      Nov 29 '15 at 22:08






    • 2





      You can accomplish the same thing with the noinput arg: manage.py collectstatic --noinput stackoverflow.com/questions/8705305/…

      – ptevans
      Nov 4 '16 at 0:34





















    • works ! great, thank you ! nice hack!

      – Paul Bernhard Wagner
      Nov 29 '15 at 22:08






    • 2





      You can accomplish the same thing with the noinput arg: manage.py collectstatic --noinput stackoverflow.com/questions/8705305/…

      – ptevans
      Nov 4 '16 at 0:34



















    works ! great, thank you ! nice hack!

    – Paul Bernhard Wagner
    Nov 29 '15 at 22:08





    works ! great, thank you ! nice hack!

    – Paul Bernhard Wagner
    Nov 29 '15 at 22:08




    2




    2





    You can accomplish the same thing with the noinput arg: manage.py collectstatic --noinput stackoverflow.com/questions/8705305/…

    – ptevans
    Nov 4 '16 at 0:34







    You can accomplish the same thing with the noinput arg: manage.py collectstatic --noinput stackoverflow.com/questions/8705305/…

    – ptevans
    Nov 4 '16 at 0:34















    1














    You can try



    python manage.py collectstatic --noinput





    share|improve this answer




























      1














      You can try



      python manage.py collectstatic --noinput





      share|improve this answer


























        1












        1








        1







        You can try



        python manage.py collectstatic --noinput





        share|improve this answer













        You can try



        python manage.py collectstatic --noinput






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 7 at 6:13









        Susaj S NairSusaj S Nair

        113




        113






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f703762%2fhow-to-write-a-script-that-does-collectstatic-for-django%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?