python - Django ImportError no module named -


I have been googling this whole day and have not come across a solution, hope you can help: / p>

Using Django 1.6, I have created an app called "Builds" as part of a project called "Computer Builder".

The site works fine when testing, though I created a file with some items in the database, and when I got the python fillDB.py :

 < Returns the error in running code> traceback (the most recent call final): file "fillDB.py", line 1,   

this file my file fillDB.py: builds.models Import BuildsTable moboDB = Open ("Db.txt", "r") line = moboDB.read (). Split ('\ ",' ') Print Lines DEF Main (): Global lines global items for items in lines: mobo = Buildsable.objects .get (moboListing ="% s "% items [0]) price_local = Buildsable.objects .get (moboListing = "% s"% items [1]) if (BuildsTable.objects.filter (moboListing = mobo, price = price_local)) .exists () == false): mydb = buildsable (moboListing = mobo, price = Price_local) mydb.save () main ()

This is my models.py file "created" app that I created:

  django db import model # make your model here. Category builds (models.Model): id = models.AutoField (primary_key = true) moboListing = Model .CharField (max_length = 200) price = models.IntegerField ()   

My directory looks like this:

  one ???? ???? ???? ???? ???? ???? ???? ???? ???? ?????? Admin.py a single ???? a ???? __init__.py a ??? ?? ???? ???? ???? ???? a ???? models.py a single ???? ???? ???? ?????.py.txt.py a single ???? Views.py.py a Line Line Computer manufacturer a ???? One ???? One ???? God au ???? One ???? One ???? One ???? Db.txt one ???? a???? One ???? One ???? One ???? FillDB.py one a ???? One ???? One ???? __init__.py one ???? One ???? One ???? One ???? Settings.py one single One ???? One ???? Urls.py one ???? One ???? One ???? One ???? Views.py a single ???? One ???? One ???? Wsgi.py one ???? Line Manage.py ?????? Line Necessities.txt   

Because I'm not using an external file which is part of Django, I think that's the reason to recognize it because if it helps, then the postgres Also use

You must add init to py in the Dev folder because it is a Python package Is considered as the form. After this, you have to add your own demo project path to fillDB.py like this,

  root "one" ??? Line Line Line ??a???? Produces ??? One ???? One ???? One ???? Admin.py a single ???? One ???? One ???? __init__.py one ???? One ???? One ???? One ???? Models.py one single ???? One ???? One ???? Test.py one a ???? One ???? One ???? Views.py one ???? Line Line Computer manufacturer a ???? One ???? One ???? God god One ???? One ???? One ???? Db.txt A A One ???? One ???? One ???? FillDB.py one a ???? One ???? One ???? __init__.py one ???? One ???? One ???? One ???? Settings.py one single One ???? One ???? Urls.py one ???? One ???? One ???? One ???? Views.py one a ???? One ???? One ???? Wsgi.py one ???? One ???? Manage.py ?????? Line Requirements.txt   

Follow the above folder structure, and you must set the Django environment variable in this file.

fillDB.py

  Import import system os if __name__ == "__main__": sys.path.append ('/ path / Root ') os.environ.setdefault ("DJANGO_SETTINGS_MODULE", "computerbuilder.settings") BuildsTable mobo = BuildsTable.objects.all () from Builds.models print mobo   

Hope this Your help

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -