Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of the project #22

Open
reemaRaven opened this issue Nov 20, 2018 · 7 comments
Open

Implementation of the project #22

reemaRaven opened this issue Nov 20, 2018 · 7 comments

Comments

@reemaRaven
Copy link

reemaRaven commented Nov 20, 2018

I have implemented the sample project. But cannot see the results after clicking upload button.
See attachment. https://drive.google.com/drive/folders/19yIF1S4YnLbUuJGvkV7k8av5jamWKikm?usp=sharing

@axelpale
Copy link
Owner

Hi!

Which upload-example version are you using? I assume v2.0 but could you confirm?

The http 405 error refers that the method is not allowed. This probably is a problem with routes.

Did you customize the example code in any way?

To which URL does your upload form point to? I mean, what is the value of action attribute of your form element?

Hope this helps you further.

@reemaRaven
Copy link
Author

Hi!
Thanks for the quick response. Yes it is Django 2.1 .
If you will check the same drive link, I have attached the zip of the project.
https://drive.google.com/open?id=19yIF1S4YnLbUuJGvkV7k8av5jamWKikm

(tmp_yr0cz.zip , password is in the zip_pass.txt file)
Only difference between your project and my implementation is that your project name is "myproject" within which there is myapp. In mine, the project name is "app" and app within it is "myapp".

I haven't customized it in anyway yet. I dont see a form action on the button in your code either.
Am I missing something?

Thanks!

@reemaRaven
Copy link
Author

I had two more questions :

  1. In the settings.py , when I add below,
    MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
    MEDIA_URL = '/media/'

Am I also supposed to create a media folder for it? If so, what should be the absolute path for it.

  1. Within models.py,

    class Document(models.Model):
    docfile = models.FileField(upload_to='documents/%Y/%m/%d')

Am I supposed to have a documents folder already? If so, what should be the absolute path for it.

@axelpale
Copy link
Owner

Unfortunately I do not have much time to look into it, but there is some that could take you further:

  • The most recent upload-example is for v2.0. There is no upload-example for v2.1 yet. You have Django v2.1 so it might cause issues.
  • Does your line 21 in myproject/urls.py point to myapp.urls or app.urls?
  • Does your situation change if you rename your app dir to myapp like in the upload-example?
  • By action attribute of the form element I refer to this line. It does not have much to do with the button.
  • About upload_to parameter, the documentation says "the string value will be appended to your MEDIA_ROOT path". The documentation is your friend in these matters.

@reemaRaven
Copy link
Author

Hi,

found the issue. Please update your myproject/myproject/urls.py with a home redirector (third line).
That way, after upload, it will redirect to the same page.

urlpatterns = [
path('admin/', admin.site.urls),
path('myapp/', include('myapp.urls'))
path('',views.list, name='list')
]

thanks a lot!

@axelpale
Copy link
Owner

Hi, great! Let us keep this issue open, as a reminder, until that thing gets fixed. Thanks!

@reemaRaven
Copy link
Author

Yeah Sure! This is great help. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants