Flask command running in an environment and not running in another2019 Community Moderator ElectionCalling an external command in PythonIs there a way to run Python on Android?How to access environment variable values?flask “hello world” can not run in debug modelHow do I import modules in pycharm?ImportError: No module named flask.ext.sqlalchemyShould I run normal flask app and sockets on the same ports?Compute Engine: URLFetch is not available in this environmentDjango segmentation fault when querying model within runserverPython Flask - Problem with entry point and app structure when deploying on Ubuntu

How do I hide Chekhov's Gun?

PlotLabels with equations not expressions

Official degrees of earth’s rotation per day

An Accountant Seeks the Help of a Mathematician

Does splitting a potentially monolithic application into several smaller ones help prevent bugs?

Provisioning profile doesn't include the application-identifier and keychain-access-groups entitlements

Brexit - No Deal Rejection

Sword in the Stone story where the sword was held in place by electromagnets

What does it mean to make a bootable LiveUSB?

Happy pi day, everyone!

Using "wallow" verb with object

Rules about breaking the rules. How do I do it well?

Where is the 1/8 CR apprentice in Volo's Guide to Monsters?

Know when to turn notes upside-down(eighth notes, sixteen notes, etc.)

Counting certain elements in lists

How to deal with a cynical class?

Could the Saturn V actually have launched astronauts around Venus?

What has been your most complicated TikZ drawing?

Russian cases: A few examples, I'm really confused

How to simplify this time periods definition interface?

PTIJ: Who should pay for Uber rides: the child or the parent?

Humanity loses the vast majority of its technology, information, and population in the year 2122. How long does it take to rebuild itself?

Is it possible / allowed to upcast ritual spells?

Life insurance that covers only simultaneous/dual deaths



Flask command running in an environment and not running in another



2019 Community Moderator ElectionCalling an external command in PythonIs there a way to run Python on Android?How to access environment variable values?flask “hello world” can not run in debug modelHow do I import modules in pycharm?ImportError: No module named flask.ext.sqlalchemyShould I run normal flask app and sockets on the same ports?Compute Engine: URLFetch is not available in this environmentDjango segmentation fault when querying model within runserverPython Flask - Problem with entry point and app structure when deploying on Ubuntu










0















I have a flask app that are running in a local machine when runing flask run but it's not running in an AWS EC2.



  • Both environment have Ubuntu 16.04 and Python 2.7.

  • Both are running in virtualenvs created in the same way and path (only user's folder is different).

  • Both have the same Flask version.

  • Both have python-dotenv and .flaskenv file and are set to
    development and debug.

  • Both have the same project folder (same git repo) and I flask run
    in the same folder for both.

  • I defined the PORT in .flaskenv and I can see that the PORT defined
    in there is where flask is running in both.

When I try to get the same URL, in EC2 I got an error: NoAppException: Could not import "app.initialize"



Running in local machine:



$ flask run
* Serving Flask app "app.initialize:web_app" (lazy loading)
* Environment: development
* Debug mode: on
* Running on http://0.0.0.0:5324/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 179-083-368


Log:



127.0.0.1 - - [07/Mar/2019 09:10:13] "GET /api/directors/me/info HTTP/1.0" 200 -


Running un EC2:



$ flask run
* Serving Flask app "app.initialize:web_app" (lazy loading)
* Environment: development
* Debug mode: on
* Running on http://0.0.0.0:5324/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 104-758-876


Log:



127.0.0.1 - - [07/Mar/2019 12:05:42] "GET /api/directors/me/info HTTP/1.0" 500 -
Traceback (most recent call last):
File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 325, in __call__
self._flush_bg_loading_exception()
File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 313, in _flush_bg_loading_exception
reraise(*exc_info)
File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 302, in _load_app
self._load_unlocked()
File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 317, in _load_unlocked
self._app = rv = self.loader()
File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 371, in load_app
app = locate_app(self, import_name, name)
File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 246, in locate_app
'Could not import "name".'.format(name=module_name)
NoAppException: Could not import "app.initialize".


For this app, I have a custom flask command and when I try to call this command for both environment, on the local machine works fine, but in EC2 I got a No such command error.



I really tried everything I found in SO about checking if things are getting imported right, packages versions and etc. In EC2, when I ipython, I can import app.initialize and I can even import models and use my app code to run things, including the command function.



Finally, if I run this app using Gunicorn in EC2, its works fine, but sometime I need to run with flask for debug (its a sandbox environment) and I need to run custom commands too.



Any idea what may be wrong in EC2?



Ty All










share|improve this question


























    0















    I have a flask app that are running in a local machine when runing flask run but it's not running in an AWS EC2.



    • Both environment have Ubuntu 16.04 and Python 2.7.

    • Both are running in virtualenvs created in the same way and path (only user's folder is different).

    • Both have the same Flask version.

    • Both have python-dotenv and .flaskenv file and are set to
      development and debug.

    • Both have the same project folder (same git repo) and I flask run
      in the same folder for both.

    • I defined the PORT in .flaskenv and I can see that the PORT defined
      in there is where flask is running in both.

    When I try to get the same URL, in EC2 I got an error: NoAppException: Could not import "app.initialize"



    Running in local machine:



    $ flask run
    * Serving Flask app "app.initialize:web_app" (lazy loading)
    * Environment: development
    * Debug mode: on
    * Running on http://0.0.0.0:5324/ (Press CTRL+C to quit)
    * Restarting with stat
    * Debugger is active!
    * Debugger PIN: 179-083-368


    Log:



    127.0.0.1 - - [07/Mar/2019 09:10:13] "GET /api/directors/me/info HTTP/1.0" 200 -


    Running un EC2:



    $ flask run
    * Serving Flask app "app.initialize:web_app" (lazy loading)
    * Environment: development
    * Debug mode: on
    * Running on http://0.0.0.0:5324/ (Press CTRL+C to quit)
    * Restarting with stat
    * Debugger is active!
    * Debugger PIN: 104-758-876


    Log:



    127.0.0.1 - - [07/Mar/2019 12:05:42] "GET /api/directors/me/info HTTP/1.0" 500 -
    Traceback (most recent call last):
    File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 325, in __call__
    self._flush_bg_loading_exception()
    File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 313, in _flush_bg_loading_exception
    reraise(*exc_info)
    File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 302, in _load_app
    self._load_unlocked()
    File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 317, in _load_unlocked
    self._app = rv = self.loader()
    File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 371, in load_app
    app = locate_app(self, import_name, name)
    File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 246, in locate_app
    'Could not import "name".'.format(name=module_name)
    NoAppException: Could not import "app.initialize".


    For this app, I have a custom flask command and when I try to call this command for both environment, on the local machine works fine, but in EC2 I got a No such command error.



    I really tried everything I found in SO about checking if things are getting imported right, packages versions and etc. In EC2, when I ipython, I can import app.initialize and I can even import models and use my app code to run things, including the command function.



    Finally, if I run this app using Gunicorn in EC2, its works fine, but sometime I need to run with flask for debug (its a sandbox environment) and I need to run custom commands too.



    Any idea what may be wrong in EC2?



    Ty All










    share|improve this question
























      0












      0








      0








      I have a flask app that are running in a local machine when runing flask run but it's not running in an AWS EC2.



      • Both environment have Ubuntu 16.04 and Python 2.7.

      • Both are running in virtualenvs created in the same way and path (only user's folder is different).

      • Both have the same Flask version.

      • Both have python-dotenv and .flaskenv file and are set to
        development and debug.

      • Both have the same project folder (same git repo) and I flask run
        in the same folder for both.

      • I defined the PORT in .flaskenv and I can see that the PORT defined
        in there is where flask is running in both.

      When I try to get the same URL, in EC2 I got an error: NoAppException: Could not import "app.initialize"



      Running in local machine:



      $ flask run
      * Serving Flask app "app.initialize:web_app" (lazy loading)
      * Environment: development
      * Debug mode: on
      * Running on http://0.0.0.0:5324/ (Press CTRL+C to quit)
      * Restarting with stat
      * Debugger is active!
      * Debugger PIN: 179-083-368


      Log:



      127.0.0.1 - - [07/Mar/2019 09:10:13] "GET /api/directors/me/info HTTP/1.0" 200 -


      Running un EC2:



      $ flask run
      * Serving Flask app "app.initialize:web_app" (lazy loading)
      * Environment: development
      * Debug mode: on
      * Running on http://0.0.0.0:5324/ (Press CTRL+C to quit)
      * Restarting with stat
      * Debugger is active!
      * Debugger PIN: 104-758-876


      Log:



      127.0.0.1 - - [07/Mar/2019 12:05:42] "GET /api/directors/me/info HTTP/1.0" 500 -
      Traceback (most recent call last):
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 325, in __call__
      self._flush_bg_loading_exception()
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 313, in _flush_bg_loading_exception
      reraise(*exc_info)
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 302, in _load_app
      self._load_unlocked()
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 317, in _load_unlocked
      self._app = rv = self.loader()
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 371, in load_app
      app = locate_app(self, import_name, name)
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 246, in locate_app
      'Could not import "name".'.format(name=module_name)
      NoAppException: Could not import "app.initialize".


      For this app, I have a custom flask command and when I try to call this command for both environment, on the local machine works fine, but in EC2 I got a No such command error.



      I really tried everything I found in SO about checking if things are getting imported right, packages versions and etc. In EC2, when I ipython, I can import app.initialize and I can even import models and use my app code to run things, including the command function.



      Finally, if I run this app using Gunicorn in EC2, its works fine, but sometime I need to run with flask for debug (its a sandbox environment) and I need to run custom commands too.



      Any idea what may be wrong in EC2?



      Ty All










      share|improve this question














      I have a flask app that are running in a local machine when runing flask run but it's not running in an AWS EC2.



      • Both environment have Ubuntu 16.04 and Python 2.7.

      • Both are running in virtualenvs created in the same way and path (only user's folder is different).

      • Both have the same Flask version.

      • Both have python-dotenv and .flaskenv file and are set to
        development and debug.

      • Both have the same project folder (same git repo) and I flask run
        in the same folder for both.

      • I defined the PORT in .flaskenv and I can see that the PORT defined
        in there is where flask is running in both.

      When I try to get the same URL, in EC2 I got an error: NoAppException: Could not import "app.initialize"



      Running in local machine:



      $ flask run
      * Serving Flask app "app.initialize:web_app" (lazy loading)
      * Environment: development
      * Debug mode: on
      * Running on http://0.0.0.0:5324/ (Press CTRL+C to quit)
      * Restarting with stat
      * Debugger is active!
      * Debugger PIN: 179-083-368


      Log:



      127.0.0.1 - - [07/Mar/2019 09:10:13] "GET /api/directors/me/info HTTP/1.0" 200 -


      Running un EC2:



      $ flask run
      * Serving Flask app "app.initialize:web_app" (lazy loading)
      * Environment: development
      * Debug mode: on
      * Running on http://0.0.0.0:5324/ (Press CTRL+C to quit)
      * Restarting with stat
      * Debugger is active!
      * Debugger PIN: 104-758-876


      Log:



      127.0.0.1 - - [07/Mar/2019 12:05:42] "GET /api/directors/me/info HTTP/1.0" 500 -
      Traceback (most recent call last):
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 325, in __call__
      self._flush_bg_loading_exception()
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 313, in _flush_bg_loading_exception
      reraise(*exc_info)
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 302, in _load_app
      self._load_unlocked()
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 317, in _load_unlocked
      self._app = rv = self.loader()
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 371, in load_app
      app = locate_app(self, import_name, name)
      File "/home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/flask/cli.py", line 246, in locate_app
      'Could not import "name".'.format(name=module_name)
      NoAppException: Could not import "app.initialize".


      For this app, I have a custom flask command and when I try to call this command for both environment, on the local machine works fine, but in EC2 I got a No such command error.



      I really tried everything I found in SO about checking if things are getting imported right, packages versions and etc. In EC2, when I ipython, I can import app.initialize and I can even import models and use my app code to run things, including the command function.



      Finally, if I run this app using Gunicorn in EC2, its works fine, but sometime I need to run with flask for debug (its a sandbox environment) and I need to run custom commands too.



      Any idea what may be wrong in EC2?



      Ty All







      python flask amazon-ec2






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 12:26









      Márcio DuarteMárcio Duarte

      284




      284






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You need to add the path to app to the ec2's python path. If you're in the directory of the project, run export PYTHONPATH="$(pwd):$PYTHONPATH".



          Basically if your project looks something like this in the file system:



          /home
          /myuser
          /myproject
          /app
          __init__.py
          somemodule.py


          Then you want to have /home/myuser/myproject present in the environment variable PYTHONPATH.



          You'll want to automate this since that environment variable will only be present in the shell you ran the command in. To do that you these are some potential options:



          • There may be a way for you to configure environment variables via the AWS UI (not sure).

          • You can create or use an image that already has PYTHONPATH set up and make sure you put your project in the path.

          • You can add the export command to ~/.profile if you are running a shell as the same user that will be running the application, or /etc/profile if you just want to add the path to the application for all users. Then reboot the server.

          But before worrying about that, to test that the solution is correct follow these steps:



          1. SSH into the ec2 instance

          2. Start a python shell with python

          3. Run this statement (it should fail due to an import error): import app.initialize

          4. Exit the shell with exit() or ctrl-d

          5. Export the path to app

          6. Repeat steps 2-3, except this time they should succeed





          share|improve this answer

























          • import app.initialize works in python and in ipython if I run it from the project folder, where the app folder is. And that is what causing more trouble, because I always thought the current folder will always been add to the PYTHONPATH by default in linux because this test worked. Don't know why the import worked in python without the folder set in PYTHONPATH, but export PYTHONPATH=$PYTHONPATH:/home/my-user/project-folder & flask run worked. Thank you Sam, I will set this var in my environment.

            – Márcio Duarte
            Mar 8 at 15:34











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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%2fstackoverflow.com%2fquestions%2f55043778%2fflask-command-running-in-an-environment-and-not-running-in-another%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You need to add the path to app to the ec2's python path. If you're in the directory of the project, run export PYTHONPATH="$(pwd):$PYTHONPATH".



          Basically if your project looks something like this in the file system:



          /home
          /myuser
          /myproject
          /app
          __init__.py
          somemodule.py


          Then you want to have /home/myuser/myproject present in the environment variable PYTHONPATH.



          You'll want to automate this since that environment variable will only be present in the shell you ran the command in. To do that you these are some potential options:



          • There may be a way for you to configure environment variables via the AWS UI (not sure).

          • You can create or use an image that already has PYTHONPATH set up and make sure you put your project in the path.

          • You can add the export command to ~/.profile if you are running a shell as the same user that will be running the application, or /etc/profile if you just want to add the path to the application for all users. Then reboot the server.

          But before worrying about that, to test that the solution is correct follow these steps:



          1. SSH into the ec2 instance

          2. Start a python shell with python

          3. Run this statement (it should fail due to an import error): import app.initialize

          4. Exit the shell with exit() or ctrl-d

          5. Export the path to app

          6. Repeat steps 2-3, except this time they should succeed





          share|improve this answer

























          • import app.initialize works in python and in ipython if I run it from the project folder, where the app folder is. And that is what causing more trouble, because I always thought the current folder will always been add to the PYTHONPATH by default in linux because this test worked. Don't know why the import worked in python without the folder set in PYTHONPATH, but export PYTHONPATH=$PYTHONPATH:/home/my-user/project-folder & flask run worked. Thank you Sam, I will set this var in my environment.

            – Márcio Duarte
            Mar 8 at 15:34
















          1














          You need to add the path to app to the ec2's python path. If you're in the directory of the project, run export PYTHONPATH="$(pwd):$PYTHONPATH".



          Basically if your project looks something like this in the file system:



          /home
          /myuser
          /myproject
          /app
          __init__.py
          somemodule.py


          Then you want to have /home/myuser/myproject present in the environment variable PYTHONPATH.



          You'll want to automate this since that environment variable will only be present in the shell you ran the command in. To do that you these are some potential options:



          • There may be a way for you to configure environment variables via the AWS UI (not sure).

          • You can create or use an image that already has PYTHONPATH set up and make sure you put your project in the path.

          • You can add the export command to ~/.profile if you are running a shell as the same user that will be running the application, or /etc/profile if you just want to add the path to the application for all users. Then reboot the server.

          But before worrying about that, to test that the solution is correct follow these steps:



          1. SSH into the ec2 instance

          2. Start a python shell with python

          3. Run this statement (it should fail due to an import error): import app.initialize

          4. Exit the shell with exit() or ctrl-d

          5. Export the path to app

          6. Repeat steps 2-3, except this time they should succeed





          share|improve this answer

























          • import app.initialize works in python and in ipython if I run it from the project folder, where the app folder is. And that is what causing more trouble, because I always thought the current folder will always been add to the PYTHONPATH by default in linux because this test worked. Don't know why the import worked in python without the folder set in PYTHONPATH, but export PYTHONPATH=$PYTHONPATH:/home/my-user/project-folder & flask run worked. Thank you Sam, I will set this var in my environment.

            – Márcio Duarte
            Mar 8 at 15:34














          1












          1








          1







          You need to add the path to app to the ec2's python path. If you're in the directory of the project, run export PYTHONPATH="$(pwd):$PYTHONPATH".



          Basically if your project looks something like this in the file system:



          /home
          /myuser
          /myproject
          /app
          __init__.py
          somemodule.py


          Then you want to have /home/myuser/myproject present in the environment variable PYTHONPATH.



          You'll want to automate this since that environment variable will only be present in the shell you ran the command in. To do that you these are some potential options:



          • There may be a way for you to configure environment variables via the AWS UI (not sure).

          • You can create or use an image that already has PYTHONPATH set up and make sure you put your project in the path.

          • You can add the export command to ~/.profile if you are running a shell as the same user that will be running the application, or /etc/profile if you just want to add the path to the application for all users. Then reboot the server.

          But before worrying about that, to test that the solution is correct follow these steps:



          1. SSH into the ec2 instance

          2. Start a python shell with python

          3. Run this statement (it should fail due to an import error): import app.initialize

          4. Exit the shell with exit() or ctrl-d

          5. Export the path to app

          6. Repeat steps 2-3, except this time they should succeed





          share|improve this answer















          You need to add the path to app to the ec2's python path. If you're in the directory of the project, run export PYTHONPATH="$(pwd):$PYTHONPATH".



          Basically if your project looks something like this in the file system:



          /home
          /myuser
          /myproject
          /app
          __init__.py
          somemodule.py


          Then you want to have /home/myuser/myproject present in the environment variable PYTHONPATH.



          You'll want to automate this since that environment variable will only be present in the shell you ran the command in. To do that you these are some potential options:



          • There may be a way for you to configure environment variables via the AWS UI (not sure).

          • You can create or use an image that already has PYTHONPATH set up and make sure you put your project in the path.

          • You can add the export command to ~/.profile if you are running a shell as the same user that will be running the application, or /etc/profile if you just want to add the path to the application for all users. Then reboot the server.

          But before worrying about that, to test that the solution is correct follow these steps:



          1. SSH into the ec2 instance

          2. Start a python shell with python

          3. Run this statement (it should fail due to an import error): import app.initialize

          4. Exit the shell with exit() or ctrl-d

          5. Export the path to app

          6. Repeat steps 2-3, except this time they should succeed






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 7 at 13:41

























          answered Mar 7 at 13:24









          Sam PSam P

          697824




          697824












          • import app.initialize works in python and in ipython if I run it from the project folder, where the app folder is. And that is what causing more trouble, because I always thought the current folder will always been add to the PYTHONPATH by default in linux because this test worked. Don't know why the import worked in python without the folder set in PYTHONPATH, but export PYTHONPATH=$PYTHONPATH:/home/my-user/project-folder & flask run worked. Thank you Sam, I will set this var in my environment.

            – Márcio Duarte
            Mar 8 at 15:34


















          • import app.initialize works in python and in ipython if I run it from the project folder, where the app folder is. And that is what causing more trouble, because I always thought the current folder will always been add to the PYTHONPATH by default in linux because this test worked. Don't know why the import worked in python without the folder set in PYTHONPATH, but export PYTHONPATH=$PYTHONPATH:/home/my-user/project-folder & flask run worked. Thank you Sam, I will set this var in my environment.

            – Márcio Duarte
            Mar 8 at 15:34

















          import app.initialize works in python and in ipython if I run it from the project folder, where the app folder is. And that is what causing more trouble, because I always thought the current folder will always been add to the PYTHONPATH by default in linux because this test worked. Don't know why the import worked in python without the folder set in PYTHONPATH, but export PYTHONPATH=$PYTHONPATH:/home/my-user/project-folder & flask run worked. Thank you Sam, I will set this var in my environment.

          – Márcio Duarte
          Mar 8 at 15:34






          import app.initialize works in python and in ipython if I run it from the project folder, where the app folder is. And that is what causing more trouble, because I always thought the current folder will always been add to the PYTHONPATH by default in linux because this test worked. Don't know why the import worked in python without the folder set in PYTHONPATH, but export PYTHONPATH=$PYTHONPATH:/home/my-user/project-folder & flask run worked. Thank you Sam, I will set this var in my environment.

          – Márcio Duarte
          Mar 8 at 15:34




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • 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%2fstackoverflow.com%2fquestions%2f55043778%2fflask-command-running-in-an-environment-and-not-running-in-another%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

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

          How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page