GithubHelp home page GithubHelp logo

axelpale / minimal-django-file-upload-example Goto Github PK

View Code? Open in Web Editor NEW
600.0 30.0 243.0 108 KB

Source code for an example app at http://stackoverflow.com/questions/5871730/need-a-minimal-django-file-upload-example

Python 89.53% HTML 10.47%

minimal-django-file-upload-example's Introduction

minimal-django-file-upload-example

Project contains source code that was made originally for the Django file upload example at StackOverflow.

The goal with minimal-django-file-upload-example is to demonstrate and teach how file uploading is done with Django. Because of the academic nature of the project all the extra functionality is left out. Otherwise you would have hard time to guess what is important and what is not.

The following Django versions are supported:

Usage (Django 3.0)

Django 3.0 supports Python 3.6, 3.7, and 3.8. Using a virtual environment is highly recommended although not strictly required.

$ git clone https://github.com/axelpale/minimal-django-file-upload-example.git
$ cd minimal-django-file-upload-example
$ cd src/for_django_3-0
$ pip install -r requirements.txt (only if you don't have Django 3.0 installed)
$ python manage.py migrate
$ python manage.py runserver

Usage (Django 2.0.2)

First ensure you have Django 2.0.2 installed. Then:

$ git clone https://github.com/axelpale/minimal-django-file-upload-example.git
$ cd minimal-django-file-upload-example
$ cd src/for_django_2-0/myproject
$ python manage.py makemigrations
$ python manage.py migrate --run-syncdb
$ python manage.py runserver

Usage (Django 1.9)

First ensure you have Django 1.9 installed. Then:

$ git clone https://github.com/axelpale/minimal-django-file-upload-example.git
$ cd minimal-django-file-upload-example
$ cd src/for_django_1-9/myproject
$ python manage.py migrate
$ python manage.py runserver

Differences between code for Django 1.7 and 1.8

  • settings.py: New TEMPLATE settings. See upgrading instructions for details.
  • settings.py: reverted to the default directory for db.sqlite3 database and media dir.
  • urls.py: Added explicit RedirectView permanent argument: RedirectView.as_view(url='/myapp/list/', permanent=True))

Differences between code for Django 1.6 and 1.7

  • use ./manage.py migrate instead of ./manage.py syncdb

Differences between code for Django 1.5 and 1.6

  • myapp/urls.py: changed the line from django.conf.urls.defaults import patterns, url to from django.conf.urls import patterns, url

Differences between code for Django 1.4 and 1.5

  • urls.py: Django 1.5 recommends RedirectView to be used instead of django.views.generic.simple.redirect_to. See RedirectView for details.
  • list.html: url template tag requires view names to be double quoted. See Django 1.5 release note overview for details.

Differences between code for Django 1.3 and 1.4

  • Directory hierachy follows Django's defaults. For example manage.py has risen one level up.
  • Due to hierarchy change absolute package paths are now more recommended and therefore used. Look INSTALLED_APPS in settings.py for example.
  • Little more comments
  • More encoding definitions # -- coding: utf-8 --
  • Database renamed to database.sqlite3

minimal-django-file-upload-example's People

Contributors

arthedian avatar axelpale avatar bartleby2718 avatar basrihsn avatar dohvis avatar elitetk avatar gentoo90 avatar saranshvatsa avatar wliyongfeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minimal-django-file-upload-example's Issues

Restricting File Uploads to certain types only

Hello. I really love your project and I want to use it in one of my apps, however I would like to know how and where can I impose upload restrictions so that users can only upload *.doc, *.pdf, *.docx, *.txt, and prevent anything else, including files such as file.txt.exe (for obvious reasons).

Where do you think I can make that modification? In the code, the DB view?

Thank you.

Error in readme

Where you wrote
myapp/urls.py: changed from django.conf.urls import patterns, url to from django.conf.urls.defaults import patterns, url
i think is just the other way around
myapp/urls.py: changed from django.conf.urls.defaults import patterns, url to from django.conf.urls import patterns, url

Example for 1.7

Django 1.7 was released, can an example for it be written?

Displaying the uploaded file in the browser.

Hi,

I am fairly new to python and django and I was hoping that you can provide me with an example for displaying the uploaded file in the browser along with other metadata related that particular file.

Thanks

Using this project with mod_wsgi

Hello, I like this app and I want to use it with apache. What should the *.wsgi file contain that I should link Apache via WSGIScriptAlias?

Thank you

HTML Templates?

Hi, are there any other HTML templates for this project other than the original? Thanks!

environment Path is fixed.. cant execute another django project

Executed the file , minimal-django-file-upload-example/src/for_django_1-9/myproject Using python manage.py runserver all executed fine , but when i tried to another project of mine , path not changing .. plzz help me with solution.

I am a Beginner to Django <<

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.