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

  • SEARCH
  • Home
  • 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 5979877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:43:18+00:00 2026-05-22T21:43:18+00:00

My form looks like this def handle(self,filefield_data): Upload the file data, in chunks, to

  • 0

My form looks like this

 def handle(self,filefield_data):
        """ Upload the file data, in chunks, to the SHP_UPLOAD_DIR specified in settings.py.
        """
        # ensure the upload directory exists
        if not os.path.exists(settings.SHP_UPLOAD_DIR):
            os.makedirs(settings.SHP_UPLOAD_DIR) 

        # contruct the full filepath and filename
        downloaded_file = os.path.normpath(os.path.join(settings.SHP_UPLOAD_DIR, filefield_data.name))

The error I get is SHP_UPLOAD_DIR is not declared in settings.py. I understand that I need to declare the directory in settings.py , but how do I declare it in settings.py and do I need to also create a SHP_UPLOAD_DIR . If I have to create such a directory , what should be its path ?

  • 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-22T21:43:19+00:00Added an answer on May 22, 2026 at 9:43 pm

    You need to add a line to your settings.py file:

    SHP_UPLOAD_DIR = r"c:\path\to\directory"
    

    You will need to create this directory yourself*, and it can be anywhere there is space for the files to live. The only requirement is that the user your website is running as has to be able to write to it. Your best bet is to put it somewhere and then see if you get an error when uploading a file.

    • you could write some code to get Python to create the directory for you, but that’s complicating matters a bit.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the standard authentication form. It's clean method looks like this : def
I have a form that looks like this: class SampleForm(forms.Form): text = forms.CharField(max_length=100) In
I have a form that looks like this. <form action=index.php method=post> <select name=dropdownOption> <option
I would like to validate the DNF (Disjunctive normal form) which looks like this
A string looks like this: <form id=unban method=post action=unban.php?uid=<? echo $uID; ?>> <input type=hidden
I have a form that looks kind of like this: <div> <div class=contact> <h1>Person's
I have a form in a .html files where input/select box looks like this
y0 c0derz! My formula looks like this: <form method=post action=index.php?sida=upl enctype=multipart/form-data name=myform> <input type=file
I have a webpage with a form, which looks kinda like this: @using (Html.BeginForm(MyAction,
My Artist conroller, edit method looks like this def edit @user = User.find(params[:id]) end

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.