Opened 7 years ago

Closed 7 years ago

#10341 closed (duplicate)

Project module loaded twice

Reported by: rginda@… Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I have some initialization code in my project's (the one from the same directory as, and I've notice that it's executed *twice* for each thread. I added the following lines to my

  print "*** thread: %s, %s" % (thread.get_ident(), __name__)

And found...

$ ~/dist/mark1/bin/ runserver ginda1:8080
*** thread: -1208932672, mark1
  File "", line 6, in <module>
    import mark1.settings
  File "/home/au/au10010/dist/mark1/django/mark1/", line 53, in <module>
*** thread: -1208932672, mark1.
  File "", line 14, in <module>
  File "/opt/ark/sw/python2.6/lib/python2.6/site-packages/django/core/management/", line 338,
 in execute_manager
  File "/opt/ark/sw/python2.6/lib/python2.6/site-packages/django/core/management/", line 316,
 in setup_environ
  File "/home/au/au10010/dist/mark1/django/mark1/", line 53, in <module>

It seems like it's loaded for the first time when loads the settings file, and second time from <>.

Notice that the second time it's loaded, the module is called 'mark1.', rather than just 'mark1'. If I switch the management code to...

    project_module = sys.modules[project_name]

...then my module is only loaded once.

Change History (1)

comment:1 Changed 7 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #8193.

Note: See TracTickets for help on using tickets.
Back to Top