Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 739921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:27:21+00:00 2026-05-14T08:27:21+00:00

I have a script which reads data from a csv file. I need to

  • 0

I have a script which reads data from a csv file. I need to store the data into a database which has already been created as

$ python manage.py syncdb

so, that automated data entry is possible in an easier manner, as available in the django shell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:27:22+00:00Added an answer on May 14, 2026 at 8:27 am

    You have to set up a django environment to use in your script, afterwards your python script can work with django models just as in the ‘real’ site:

    The easiest way to do this: set the DJANGO_SETTINGS_MODULE environment variable (e.g. export DJANGO_SETTINGS_MODULE=mysite.settings ). Then your script can do things like:

    from app.models import MyModel
    
    a = MyModel(field=value)
    a.save()
    

    There are also some other ways, where you have to write some additional code in your script, I prefer these because they do not require an environment variable:

    1) setup_environ:

    from django.core.management import setup_environ
    import mysite.settings
    setup_environ(mysite.settings)
    

    2) Create settings on the flow:

    from django.conf import settings
    settings.configure(DEBUG=False, DATABASE_NAME="mydb", ...)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ruby script which will read data from some CSV file and
I have a php script which accesses a MSSQL2005 database, reads some data from
I have a curl script which reads the data from a remote source. Below
I have a PHP script that reads in data from an XML file, returns
I have the following PHP script which reads from two CSV files, At the
I have a data set which I read from my a .csv file. After
I have a data frame called data which I read in from a CSV
I've got a PHP script that deletes old data from a database, reads data
I have a Perl script that reads data from an Excel ( xls )
I have a Perl script that reads a simple .csv file like below- header1,header2,header3,header4

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.