how to fix circular import in django?How to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory in Python?How do I sort a dictionary by value?How to make a chain of function decorators?Does Django scale?How to make a flat list out of list of listsHow do I list all files of a directory?How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?

How come Arya Stark didn't burn in Game of Thrones Season 8 Episode 5

How to pass store code to custom URL in magento 2

Why is vowel phonology represented in a trapezoid instead of a square?

Why use a retrograde orbit?

Would it be fair to use 1d30 (instead of rolling 2d20 and taking the higher die) for advantage rolls?

How was the blinking terminal cursor invented?

"Counterexample" for the Inverse function theorem

Cross products/avoiding using your hand for the right hand rule in E and M

FIFO data structure in pure C

Do high-wing aircraft represent more difficult engineering challenges than low-wing aircraft?

Why is so much ransomware breakable?

Why does the U.S military use mercenaries?

Solenoid fastest possible release - for how long should reversed polarity be applied?

What would a Dragon have to exhale to cause rain?

Do we see some Unsullied doing this in S08E05?

Why aren't satellites disintegrated even though they orbit earth within their Roche Limits?

Using a Snow jacket for non snow conditions?

What kind of environment would favor hermaphroditism in a sentient species over regular, old sexes?

How to handle professionally if colleagues has referred his relative and asking to take easy while taking interview

Can a person still be an Orthodox Jew and believe that the Torah contains narratives that are not scientifically correct?

Square spiral in Mathematica

Resistor Selection to retain same brightness in LED PWM circuit

What is this rubber on gear cables

How could it be that 80% of townspeople were farmers during the Edo period in Japan?



how to fix circular import in django?


How to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory in Python?How do I sort a dictionary by value?How to make a chain of function decorators?Does Django scale?How to make a flat list out of list of listsHow do I list all files of a directory?How do I POST JSON data with Curl from a terminal/commandline to Test Spring REST?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm trying to create an api that uploads an image with an email to the database. But I'm getting an error "raise ImproperlyConfigured(msg.format(name=self.urlconf_name))" Is the problem in my urls.py?



https://imgur.com/OjPUhOv.jpg



This is how my structure looks



https://imgur.com/TW6pKPn.jpg



This is the error



for urls.py-



from django.contrib import admin
from django.urls import path,include
from django.conf import settings

urlpatterns = [
path('admin/', admin.site.urls),
path('',include('user.urls')),
path('api/',include('api_test.urls'))
# path('articles/',include('articles.urls'))

]


for api_test/urls.py



from django.urls import path,include
from django.conf import settings
from . import views

from rest_framework import routers

router = routers.DefaultRouter()
router.register('image_test',views.api_test,base_name='image_test')

urlpatterns = [
# path('/',views.api_test),
path('',include(routers.url)),


]


for views.py



class api_test(viewsets.ModelViewSet):
queryset = fineDB.objects.all()
serializer_class = fineSerializer

##for serializers.py

from rest_framework import serializers
from .models import fineDB

class fineSerializer(serializers.ModelSerializer):
image = serializers.ImageField(max_length=None,use_url=True)
class Meta:
model = fineDB
fields = 'email','image'









share|improve this question






























    0















    I'm trying to create an api that uploads an image with an email to the database. But I'm getting an error "raise ImproperlyConfigured(msg.format(name=self.urlconf_name))" Is the problem in my urls.py?



    https://imgur.com/OjPUhOv.jpg



    This is how my structure looks



    https://imgur.com/TW6pKPn.jpg



    This is the error



    for urls.py-



    from django.contrib import admin
    from django.urls import path,include
    from django.conf import settings

    urlpatterns = [
    path('admin/', admin.site.urls),
    path('',include('user.urls')),
    path('api/',include('api_test.urls'))
    # path('articles/',include('articles.urls'))

    ]


    for api_test/urls.py



    from django.urls import path,include
    from django.conf import settings
    from . import views

    from rest_framework import routers

    router = routers.DefaultRouter()
    router.register('image_test',views.api_test,base_name='image_test')

    urlpatterns = [
    # path('/',views.api_test),
    path('',include(routers.url)),


    ]


    for views.py



    class api_test(viewsets.ModelViewSet):
    queryset = fineDB.objects.all()
    serializer_class = fineSerializer

    ##for serializers.py

    from rest_framework import serializers
    from .models import fineDB

    class fineSerializer(serializers.ModelSerializer):
    image = serializers.ImageField(max_length=None,use_url=True)
    class Meta:
    model = fineDB
    fields = 'email','image'









    share|improve this question


























      0












      0








      0








      I'm trying to create an api that uploads an image with an email to the database. But I'm getting an error "raise ImproperlyConfigured(msg.format(name=self.urlconf_name))" Is the problem in my urls.py?



      https://imgur.com/OjPUhOv.jpg



      This is how my structure looks



      https://imgur.com/TW6pKPn.jpg



      This is the error



      for urls.py-



      from django.contrib import admin
      from django.urls import path,include
      from django.conf import settings

      urlpatterns = [
      path('admin/', admin.site.urls),
      path('',include('user.urls')),
      path('api/',include('api_test.urls'))
      # path('articles/',include('articles.urls'))

      ]


      for api_test/urls.py



      from django.urls import path,include
      from django.conf import settings
      from . import views

      from rest_framework import routers

      router = routers.DefaultRouter()
      router.register('image_test',views.api_test,base_name='image_test')

      urlpatterns = [
      # path('/',views.api_test),
      path('',include(routers.url)),


      ]


      for views.py



      class api_test(viewsets.ModelViewSet):
      queryset = fineDB.objects.all()
      serializer_class = fineSerializer

      ##for serializers.py

      from rest_framework import serializers
      from .models import fineDB

      class fineSerializer(serializers.ModelSerializer):
      image = serializers.ImageField(max_length=None,use_url=True)
      class Meta:
      model = fineDB
      fields = 'email','image'









      share|improve this question
















      I'm trying to create an api that uploads an image with an email to the database. But I'm getting an error "raise ImproperlyConfigured(msg.format(name=self.urlconf_name))" Is the problem in my urls.py?



      https://imgur.com/OjPUhOv.jpg



      This is how my structure looks



      https://imgur.com/TW6pKPn.jpg



      This is the error



      for urls.py-



      from django.contrib import admin
      from django.urls import path,include
      from django.conf import settings

      urlpatterns = [
      path('admin/', admin.site.urls),
      path('',include('user.urls')),
      path('api/',include('api_test.urls'))
      # path('articles/',include('articles.urls'))

      ]


      for api_test/urls.py



      from django.urls import path,include
      from django.conf import settings
      from . import views

      from rest_framework import routers

      router = routers.DefaultRouter()
      router.register('image_test',views.api_test,base_name='image_test')

      urlpatterns = [
      # path('/',views.api_test),
      path('',include(routers.url)),


      ]


      for views.py



      class api_test(viewsets.ModelViewSet):
      queryset = fineDB.objects.all()
      serializer_class = fineSerializer

      ##for serializers.py

      from rest_framework import serializers
      from .models import fineDB

      class fineSerializer(serializers.ModelSerializer):
      image = serializers.ImageField(max_length=None,use_url=True)
      class Meta:
      model = fineDB
      fields = 'email','image'






      python django rest api django-rest-framework






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 17:01







      sayeedk06

















      asked Mar 23 at 16:38









      sayeedk06sayeedk06

      114




      114






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You should probably get the urls from router, not routers.
          At the same time you don't need both the router and the urlpatterns in that file. You can import the router and mount it's router.urls in urls.py.



          from rest_framework import routers

          router = routers.DefaultRouter()
          router.register('image_test',views.api_test,base_name='image_test')

          urlpatterns = [
          # path('/',views.api_test),
          path('',include(router.urls)), # <-


          ]





          share|improve this answer

























          • doesn't work. Says 'DefaultRouter' object has no attribute 'url'

            – sayeedk06
            Mar 23 at 16:56











          • Ah, there was a misspelling there as well. I've updated the code example.

            – jensmtg
            Mar 23 at 17:11











          • ah. Stupid me. Thanks alot. This was it

            – sayeedk06
            Mar 23 at 19:18











          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%2f55315985%2fhow-to-fix-circular-import-in-django%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









          0














          You should probably get the urls from router, not routers.
          At the same time you don't need both the router and the urlpatterns in that file. You can import the router and mount it's router.urls in urls.py.



          from rest_framework import routers

          router = routers.DefaultRouter()
          router.register('image_test',views.api_test,base_name='image_test')

          urlpatterns = [
          # path('/',views.api_test),
          path('',include(router.urls)), # <-


          ]





          share|improve this answer

























          • doesn't work. Says 'DefaultRouter' object has no attribute 'url'

            – sayeedk06
            Mar 23 at 16:56











          • Ah, there was a misspelling there as well. I've updated the code example.

            – jensmtg
            Mar 23 at 17:11











          • ah. Stupid me. Thanks alot. This was it

            – sayeedk06
            Mar 23 at 19:18















          0














          You should probably get the urls from router, not routers.
          At the same time you don't need both the router and the urlpatterns in that file. You can import the router and mount it's router.urls in urls.py.



          from rest_framework import routers

          router = routers.DefaultRouter()
          router.register('image_test',views.api_test,base_name='image_test')

          urlpatterns = [
          # path('/',views.api_test),
          path('',include(router.urls)), # <-


          ]





          share|improve this answer

























          • doesn't work. Says 'DefaultRouter' object has no attribute 'url'

            – sayeedk06
            Mar 23 at 16:56











          • Ah, there was a misspelling there as well. I've updated the code example.

            – jensmtg
            Mar 23 at 17:11











          • ah. Stupid me. Thanks alot. This was it

            – sayeedk06
            Mar 23 at 19:18













          0












          0








          0







          You should probably get the urls from router, not routers.
          At the same time you don't need both the router and the urlpatterns in that file. You can import the router and mount it's router.urls in urls.py.



          from rest_framework import routers

          router = routers.DefaultRouter()
          router.register('image_test',views.api_test,base_name='image_test')

          urlpatterns = [
          # path('/',views.api_test),
          path('',include(router.urls)), # <-


          ]





          share|improve this answer















          You should probably get the urls from router, not routers.
          At the same time you don't need both the router and the urlpatterns in that file. You can import the router and mount it's router.urls in urls.py.



          from rest_framework import routers

          router = routers.DefaultRouter()
          router.register('image_test',views.api_test,base_name='image_test')

          urlpatterns = [
          # path('/',views.api_test),
          path('',include(router.urls)), # <-


          ]






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 23 at 17:10

























          answered Mar 23 at 16:49









          jensmtgjensmtg

          513519




          513519












          • doesn't work. Says 'DefaultRouter' object has no attribute 'url'

            – sayeedk06
            Mar 23 at 16:56











          • Ah, there was a misspelling there as well. I've updated the code example.

            – jensmtg
            Mar 23 at 17:11











          • ah. Stupid me. Thanks alot. This was it

            – sayeedk06
            Mar 23 at 19:18

















          • doesn't work. Says 'DefaultRouter' object has no attribute 'url'

            – sayeedk06
            Mar 23 at 16:56











          • Ah, there was a misspelling there as well. I've updated the code example.

            – jensmtg
            Mar 23 at 17:11











          • ah. Stupid me. Thanks alot. This was it

            – sayeedk06
            Mar 23 at 19:18
















          doesn't work. Says 'DefaultRouter' object has no attribute 'url'

          – sayeedk06
          Mar 23 at 16:56





          doesn't work. Says 'DefaultRouter' object has no attribute 'url'

          – sayeedk06
          Mar 23 at 16:56













          Ah, there was a misspelling there as well. I've updated the code example.

          – jensmtg
          Mar 23 at 17:11





          Ah, there was a misspelling there as well. I've updated the code example.

          – jensmtg
          Mar 23 at 17:11













          ah. Stupid me. Thanks alot. This was it

          – sayeedk06
          Mar 23 at 19:18





          ah. Stupid me. Thanks alot. This was it

          – sayeedk06
          Mar 23 at 19:18



















          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%2f55315985%2fhow-to-fix-circular-import-in-django%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript