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

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme