Cannot import ASGI_APPLICATION module while runserver using channels 2












4















I have followed the channels tutorial but while running these error throw



Version of the packages is
channels==2.1.2
Django==2.0.4



what I missed ?
in settings.py



INSTALLED_APPS = [
"channels"
....
]

ROOT_URLCONF = 'myapp.urls'
ASGI_APPLICATION = "myapp.routing.application"


added file mayapp/routing.py



from channels.routing import ProtocolTypeRouter 

application = ProtocolTypeRouter({
# Empty for now (http->django views is added by default)
})


this is the error log



System check identified no issues (0 silenced).
August 01, 2018 - 13:11:42
Django version 2.0.4, using settings 'myapp.local_settings'
Starting ASGI/Channels version 2.1.2 development server at http://127.0.0.1:8080/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f71ecfb6400>
Traceback (most recent call last):
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/routing.py", line 33, in get_default_application
module = importlib.import_module(path)
File "/home/vkchlt0192/myapp/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'myapp.routing'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 80, in inner_run
application=self.get_application(options),
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 105, in get_application
return StaticFilesWrapper(get_default_application())
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/routing.py", line 35, in get_default_application
raise ImproperlyConfigured("Cannot import ASGI_APPLICATION module %r" % path)
django.core.exceptions.ImproperlyConfigured: Cannot import ASGI_APPLICATION module 'myapp.routing'









share|improve this question

























  • Did you get solution ?

    – a_k_v
    Oct 23 '18 at 12:50











  • now it's working for me, I am using channels==2.1.5

    – Shihabudheen K M
    Oct 23 '18 at 17:19
















4















I have followed the channels tutorial but while running these error throw



Version of the packages is
channels==2.1.2
Django==2.0.4



what I missed ?
in settings.py



INSTALLED_APPS = [
"channels"
....
]

ROOT_URLCONF = 'myapp.urls'
ASGI_APPLICATION = "myapp.routing.application"


added file mayapp/routing.py



from channels.routing import ProtocolTypeRouter 

application = ProtocolTypeRouter({
# Empty for now (http->django views is added by default)
})


this is the error log



System check identified no issues (0 silenced).
August 01, 2018 - 13:11:42
Django version 2.0.4, using settings 'myapp.local_settings'
Starting ASGI/Channels version 2.1.2 development server at http://127.0.0.1:8080/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f71ecfb6400>
Traceback (most recent call last):
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/routing.py", line 33, in get_default_application
module = importlib.import_module(path)
File "/home/vkchlt0192/myapp/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'myapp.routing'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 80, in inner_run
application=self.get_application(options),
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 105, in get_application
return StaticFilesWrapper(get_default_application())
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/routing.py", line 35, in get_default_application
raise ImproperlyConfigured("Cannot import ASGI_APPLICATION module %r" % path)
django.core.exceptions.ImproperlyConfigured: Cannot import ASGI_APPLICATION module 'myapp.routing'









share|improve this question

























  • Did you get solution ?

    – a_k_v
    Oct 23 '18 at 12:50











  • now it's working for me, I am using channels==2.1.5

    – Shihabudheen K M
    Oct 23 '18 at 17:19














4












4








4








I have followed the channels tutorial but while running these error throw



Version of the packages is
channels==2.1.2
Django==2.0.4



what I missed ?
in settings.py



INSTALLED_APPS = [
"channels"
....
]

ROOT_URLCONF = 'myapp.urls'
ASGI_APPLICATION = "myapp.routing.application"


added file mayapp/routing.py



from channels.routing import ProtocolTypeRouter 

application = ProtocolTypeRouter({
# Empty for now (http->django views is added by default)
})


this is the error log



System check identified no issues (0 silenced).
August 01, 2018 - 13:11:42
Django version 2.0.4, using settings 'myapp.local_settings'
Starting ASGI/Channels version 2.1.2 development server at http://127.0.0.1:8080/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f71ecfb6400>
Traceback (most recent call last):
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/routing.py", line 33, in get_default_application
module = importlib.import_module(path)
File "/home/vkchlt0192/myapp/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'myapp.routing'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 80, in inner_run
application=self.get_application(options),
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 105, in get_application
return StaticFilesWrapper(get_default_application())
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/routing.py", line 35, in get_default_application
raise ImproperlyConfigured("Cannot import ASGI_APPLICATION module %r" % path)
django.core.exceptions.ImproperlyConfigured: Cannot import ASGI_APPLICATION module 'myapp.routing'









share|improve this question
















I have followed the channels tutorial but while running these error throw



Version of the packages is
channels==2.1.2
Django==2.0.4



what I missed ?
in settings.py



INSTALLED_APPS = [
"channels"
....
]

ROOT_URLCONF = 'myapp.urls'
ASGI_APPLICATION = "myapp.routing.application"


added file mayapp/routing.py



from channels.routing import ProtocolTypeRouter 

application = ProtocolTypeRouter({
# Empty for now (http->django views is added by default)
})


this is the error log



System check identified no issues (0 silenced).
August 01, 2018 - 13:11:42
Django version 2.0.4, using settings 'myapp.local_settings'
Starting ASGI/Channels version 2.1.2 development server at http://127.0.0.1:8080/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f71ecfb6400>
Traceback (most recent call last):
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/routing.py", line 33, in get_default_application
module = importlib.import_module(path)
File "/home/vkchlt0192/myapp/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'myapp.routing'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 80, in inner_run
application=self.get_application(options),
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 105, in get_application
return StaticFilesWrapper(get_default_application())
File "/home/vkchlt0192/myapp/lib/python3.5/site-packages/channels/routing.py", line 35, in get_default_application
raise ImproperlyConfigured("Cannot import ASGI_APPLICATION module %r" % path)
django.core.exceptions.ImproperlyConfigured: Cannot import ASGI_APPLICATION module 'myapp.routing'






python django django-channels






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 16 '18 at 6:43







Shihabudheen K M

















asked Aug 1 '18 at 13:26









Shihabudheen K MShihabudheen K M

494311




494311













  • Did you get solution ?

    – a_k_v
    Oct 23 '18 at 12:50











  • now it's working for me, I am using channels==2.1.5

    – Shihabudheen K M
    Oct 23 '18 at 17:19



















  • Did you get solution ?

    – a_k_v
    Oct 23 '18 at 12:50











  • now it's working for me, I am using channels==2.1.5

    – Shihabudheen K M
    Oct 23 '18 at 17:19

















Did you get solution ?

– a_k_v
Oct 23 '18 at 12:50





Did you get solution ?

– a_k_v
Oct 23 '18 at 12:50













now it's working for me, I am using channels==2.1.5

– Shihabudheen K M
Oct 23 '18 at 17:19





now it's working for me, I am using channels==2.1.5

– Shihabudheen K M
Oct 23 '18 at 17:19












3 Answers
3






active

oldest

votes


















1














Just change




ASGI_APPLICATION = mysite.routing.application




to




ASGI_APPLICATION = "routing.application"







share|improve this answer































    0














    You need to put your routing.py file inside mayapp/mayapp/routing.py instead of mayapp/routing.py






    share|improve this answer
























    • Could you be more specific. File is actually inside the project root directory. It seems right file path !

      – a_k_v
      Oct 23 '18 at 12:56











    • it's on project root path, now it is working for me after update the channel version to channels==2.1.5

      – Shihabudheen K M
      Oct 23 '18 at 17:20



















    0














    Check for any potential errors (maybe import error) in consumers.py.
    Also, try to put channels as the first item in INSTALLED_APPS in settings.py.



    As stated in channels document:




    The Channels development server will conflict with any other third-party apps that require an overloaded or replacement runserver command. An example of such a conflict is with whitenoise.runserver_nostatic from whitenoise. In order to solve such issues, try moving channels to the top of your INSTALLED_APPS or remove the offending app altogether.







    share|improve this answer























      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%2f51634522%2fcannot-import-asgi-application-module-while-runserver-using-channels-2%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Just change




      ASGI_APPLICATION = mysite.routing.application




      to




      ASGI_APPLICATION = "routing.application"







      share|improve this answer




























        1














        Just change




        ASGI_APPLICATION = mysite.routing.application




        to




        ASGI_APPLICATION = "routing.application"







        share|improve this answer


























          1












          1








          1







          Just change




          ASGI_APPLICATION = mysite.routing.application




          to




          ASGI_APPLICATION = "routing.application"







          share|improve this answer













          Just change




          ASGI_APPLICATION = mysite.routing.application




          to




          ASGI_APPLICATION = "routing.application"








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 19 '18 at 18:36









          Shersha FnShersha Fn

          56711128




          56711128

























              0














              You need to put your routing.py file inside mayapp/mayapp/routing.py instead of mayapp/routing.py






              share|improve this answer
























              • Could you be more specific. File is actually inside the project root directory. It seems right file path !

                – a_k_v
                Oct 23 '18 at 12:56











              • it's on project root path, now it is working for me after update the channel version to channels==2.1.5

                – Shihabudheen K M
                Oct 23 '18 at 17:20
















              0














              You need to put your routing.py file inside mayapp/mayapp/routing.py instead of mayapp/routing.py






              share|improve this answer
























              • Could you be more specific. File is actually inside the project root directory. It seems right file path !

                – a_k_v
                Oct 23 '18 at 12:56











              • it's on project root path, now it is working for me after update the channel version to channels==2.1.5

                – Shihabudheen K M
                Oct 23 '18 at 17:20














              0












              0








              0







              You need to put your routing.py file inside mayapp/mayapp/routing.py instead of mayapp/routing.py






              share|improve this answer













              You need to put your routing.py file inside mayapp/mayapp/routing.py instead of mayapp/routing.py







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 14 '18 at 13:05









              wint3rmutewint3rmute

              11




              11













              • Could you be more specific. File is actually inside the project root directory. It seems right file path !

                – a_k_v
                Oct 23 '18 at 12:56











              • it's on project root path, now it is working for me after update the channel version to channels==2.1.5

                – Shihabudheen K M
                Oct 23 '18 at 17:20



















              • Could you be more specific. File is actually inside the project root directory. It seems right file path !

                – a_k_v
                Oct 23 '18 at 12:56











              • it's on project root path, now it is working for me after update the channel version to channels==2.1.5

                – Shihabudheen K M
                Oct 23 '18 at 17:20

















              Could you be more specific. File is actually inside the project root directory. It seems right file path !

              – a_k_v
              Oct 23 '18 at 12:56





              Could you be more specific. File is actually inside the project root directory. It seems right file path !

              – a_k_v
              Oct 23 '18 at 12:56













              it's on project root path, now it is working for me after update the channel version to channels==2.1.5

              – Shihabudheen K M
              Oct 23 '18 at 17:20





              it's on project root path, now it is working for me after update the channel version to channels==2.1.5

              – Shihabudheen K M
              Oct 23 '18 at 17:20











              0














              Check for any potential errors (maybe import error) in consumers.py.
              Also, try to put channels as the first item in INSTALLED_APPS in settings.py.



              As stated in channels document:




              The Channels development server will conflict with any other third-party apps that require an overloaded or replacement runserver command. An example of such a conflict is with whitenoise.runserver_nostatic from whitenoise. In order to solve such issues, try moving channels to the top of your INSTALLED_APPS or remove the offending app altogether.







              share|improve this answer




























                0














                Check for any potential errors (maybe import error) in consumers.py.
                Also, try to put channels as the first item in INSTALLED_APPS in settings.py.



                As stated in channels document:




                The Channels development server will conflict with any other third-party apps that require an overloaded or replacement runserver command. An example of such a conflict is with whitenoise.runserver_nostatic from whitenoise. In order to solve such issues, try moving channels to the top of your INSTALLED_APPS or remove the offending app altogether.







                share|improve this answer


























                  0












                  0








                  0







                  Check for any potential errors (maybe import error) in consumers.py.
                  Also, try to put channels as the first item in INSTALLED_APPS in settings.py.



                  As stated in channels document:




                  The Channels development server will conflict with any other third-party apps that require an overloaded or replacement runserver command. An example of such a conflict is with whitenoise.runserver_nostatic from whitenoise. In order to solve such issues, try moving channels to the top of your INSTALLED_APPS or remove the offending app altogether.







                  share|improve this answer













                  Check for any potential errors (maybe import error) in consumers.py.
                  Also, try to put channels as the first item in INSTALLED_APPS in settings.py.



                  As stated in channels document:




                  The Channels development server will conflict with any other third-party apps that require an overloaded or replacement runserver command. An example of such a conflict is with whitenoise.runserver_nostatic from whitenoise. In order to solve such issues, try moving channels to the top of your INSTALLED_APPS or remove the offending app altogether.








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 1 at 13:22









                  Bharat RajaniBharat Rajani

                  11




                  11






























                      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%2f51634522%2fcannot-import-asgi-application-module-while-runserver-using-channels-2%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

                      android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                      SQL update select statement

                      'app-layout' is not a known element: how to share Component with different Modules