Repository: doccano/doccano

Issue:
Login found——Error: Request failed with status code 500
step1:
run: `docker-compose -f docker-compose.prod.yml up`
![image](https://user-images.githubusercontent.com/11382789/80170730-3c2c5a00-861b-11ea-882a-995a8dccef4f.png)

step2: login
username:admin
password:password
![image](https://user-images.githubusercontent.com/11382789/80170770-57976500-861b-11ea-8871-7285777b943b.png)

then remind me status code 500.
![image](https://user-images.githubusercontent.com/11382789/80170803-6847db00-861b-11ea-9301-9e714fee2202.png)

terminate response.
![image](https://user-images.githubusercontent.com/11382789/80170843-7b5aab00-861b-11ea-91aa-4ae47d1cbdb5.png)

Then can create dataset and operate other. but can't annotation, i see Home->step5. annotate the dataset, but now i try annotate found not operate.
![image](https://user-images.githubusercontent.com/11382789/80171189-46028d00-861c-11ea-8fc9-050ac675907b.png)



Discussion:
Please provide your environment information following to the [ISSUE_TEMPLATE](https://github.com/doccano/doccano/blob/master/.github/ISSUE_TEMPLATE/01-question.md).

I also have the same issue
Steps to reproduce :

Login as admin -> Create project -> Logout -> Try to login as admin -> Pop up with status 500

I am running this code in Ubuntu via ` docker-compose -f docker-compose.dev.yml up`
It's a lack of information. Please show me network request/response by using chrome/safari developer tools.
I face similar issues. I was logged in as admin. I reset my password and created three users with their own passowrds. Then I created a project, and logged out. Finally I logged in as one of the users, but I got the status 500 popup:

```
Request Method: GET
Status Code: 500 Internal Server Error
```

Then I try to create a project and I receive a 403 error:

```
HTTP 403 Forbidden
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "detail": "Authentication credentials were not provided."
}
```

Operating System: Ubuntu 18.04
Python Version Used: 3.6
When you install doccano: May 1
How did you install doccano (Heroku button etc): Deployed to Digital Ocean droplet with `docker-compose -f docker-compose.prod.yml up`

EDIT: I don't get the error when I use Safari, but Firefox seems to have issues (?). 
@zephyrous @greenspray9 hello, I have solved it. shows step.
# need docker-compose command
`sudo apt install docker-compose`
# doccano images download：
`sudo docker pull chakkiworks/doccano`

# then exec,：
`sudo docker run -d --rm --name doccano \
  -e "ADMIN_USERNAME=admin" \
  -e "ADMIN_EMAIL=admin@example.com" \
  -e "ADMIN_PASSWORD=password" \
  -p 8000:8000 chakkiworks/doccano`
#### --rm exit delete images, note: data save

# chrome or safari input：
`http://127.0.0.1:8000/login/`
username：admin , password：password`
@zhanwen I was probably missing the --rm step. Will check, thanks!
I am also facing same error, how to solve this issue as i am unable to annotate.I have windows OS and have docker running but error is coming : request failed with status code 500??? 
Please help
@cmehak please see: my above comment. windows 10 can use windowspower shell execute command.
We are also facing the same issue, ran `docker-compose -f docker-compose.prod.yml up -d` on a Centos 7. No logs from the backend indicating on any issue. Perhaps it can be run with a debug mode to be able to trace the exception?
I am having the same problem as zhanwen and zephyrous  Using Ubuntu 18.04, I get 500 error when I use Firefox, Chrome
Python Version 3.7.8
When you install doccano: September 22, 2020
Commit: 6d5bff4bd03c63babe2c7164579d77ff4f0597d1
How did you install doccano (Heroku button etc): `docker-compose -f docker-compose.prod.yml up`

When I checkout commit: 4ebc32c22bd58c7397f38109e55e3c34f25bf2bc I do not get any browser errors.

  
Was this issue fully resolved. I am running Debian 10 server and I installed doccano using: `docker-compose -f docker-compose.prod.yml up` . The login page loads fine and I can successfully login with `admin` and `password`. However, the 500 error still pops up. I have tried everything suggested above.
I'm having the same problem can someone help me solve please? I receive status error 500 with the administrator user
Please try to logout from the admin site after you change the password.

https://github.com/doccano/doccano/blob/master/docs/faq.md#i-want-to-change-users-or-admins-password

Are there any users of this web app that have made it possible to run docker-compose as of 2021 without this error? I am talking latest commit, no fork, no different version, docker-compose as of 2021. How do you make this work?

clean computer, clean everything, IT DOES NOT WORK, error 500.
I found the difference between 500 errors and no errors. When we meet the 500 error, The `Allow` header in the response is empty. If we replace `DEBUG: False` with `DEBUG: True` in `docker-compose.prod.yml`, the header won't be empty. But it's not a good solution for a production environment.
I found the cause. We need to remove `image` property from Project models and serializers.

Resolving patch:
diff --git a/app/api/models.py b/app/api/models.py
--- a/app/api/models.py
+++ b/app/api/models.py
@@ -6,7 +6,6 @@
 from django.urls import reverse
 from django.conf import settings
 from django.contrib.auth.models import User
-from django.contrib.staticfiles.storage import staticfiles_storage
 from django.core.exceptions import ValidationError
 from polymorphic.models import PolymorphicModel
 
@@ -39,10 +38,6 @@ class Project(PolymorphicModel):
     def get_absolute_url(self):
         return reverse('upload', args=[self.id])
 
-    @property
-    def image(self):
-        raise NotImplementedError()
-
     def get_bundle_name(self):
         raise NotImplementedError()
 
@@ -67,10 +62,6 @@ def __str__(self):
 
 class TextClassificationProject(Project):
 
-    @property
-    def image(self):
-        return staticfiles_storage.url('assets/images/cats/text_classification.jpg')
-
     def get_bundle_name(self):
         return 'document_classification'
 
@@ -94,10 +85,6 @@ def get_storage(self, data):
 
 class SequenceLabelingProject(Project):
 
-    @property
-    def image(self):
-        return staticfiles_storage.url('assets/images/cats/sequence_labeling.jpg')
-
     def get_bundle_name(self):
         return 'sequence_labeling'
 
@@ -121,10 +108,6 @@ def get_storage(self, data):
 
 class Seq2seqProject(Project):
 
-    @property
-    def image(self):
-        return staticfiles_storage.url('assets/images/cats/seq2seq.jpg')
-
     def get_bundle_name(self):
         return 'seq2seq'
 
@@ -148,10 +131,6 @@ def get_storage(self, data):
 
 class Speech2textProject(Project):
 
-    @property
-    def image(self):
-        return staticfiles_storage.url('images/cats/speech2text.jpg')
-
     def get_bundle_name(self):
         return 'speech2text'
 
diff --git a/app/api/serializers.py b/app/api/serializers.py
--- a/app/api/serializers.py
+++ b/app/api/serializers.py
@@ -119,9 +119,9 @@ def get_current_users_role(self, instance):
 
     class Meta:
         model = Project
-        fields = ('id', 'name', 'description', 'guideline', 'users', 'current_users_role', 'project_type', 'image',
+        fields = ('id', 'name', 'description', 'guideline', 'users', 'current_users_role', 'project_type',
                   'updated_at', 'randomize_document_order', 'collaborative_annotation', 'single_class_classification')
-        read_only_fields = ('image', 'updated_at', 'users', 'current_users_role')
+        read_only_fields = ('updated_at', 'users', 'current_users_role')
 
 
 class TextClassificationProjectSerializer(ProjectSerializer):
@@ -152,9 +152,9 @@ class Speech2textProjectSerializer(ProjectSerializer):
 
     class Meta:
         model = Speech2textProject
-        fields = ('id', 'name', 'description', 'guideline', 'users', 'current_users_role', 'project_type', 'image',
+        fields = ('id', 'name', 'description', 'guideline', 'users', 'current_users_role', 'project_type',
                   'updated_at', 'randomize_document_order')
-        read_only_fields = ('image', 'updated_at', 'users', 'current_users_role')
+        read_only_fields = ('updated_at', 'users', 'current_users_role')
 
 
 class ProjectPolymorphicSerializer(PolymorphicSerializer):


Test patch:
diff --git a/app/api/tests/test_models.py b/app/api/tests/test_models.py
--- a/app/api/tests/test_models.py
+++ b/app/api/tests/test_models.py
@@ -17,10 +17,6 @@ class TestTextClassificationProject(TestCase):
     def setUpTestData(cls):
         cls.project = mommy.make('TextClassificationProject')
 
-    def test_image(self):
-        image_url = self.project.image
-        self.assertTrue(image_url.endswith('.jpg'))
-
     def test_get_bundle_name(self):
         template = self.project.get_bundle_name()
         self.assertEqual(template, 'document_classification')
@@ -41,10 +37,6 @@ class TestSequenceLabelingProject(TestCase):
     def setUpTestData(cls):
         cls.project = mommy.make('SequenceLabelingProject')
 
-    def test_image(self):
-        image_url = self.project.image
-        self.assertTrue(image_url.endswith('.jpg'))
-
     def test_get_bundle_name(self):
         template = self.project.get_bundle_name()
         self.assertEqual(template, 'sequence_labeling')
@@ -65,10 +57,6 @@ class TestSeq2seqProject(TestCase):
     def setUpTestData(cls):
         cls.project = mommy.make('Seq2seqProject')
 
-    def test_image(self):
-        image_url = self.project.image
-        self.assertTrue(image_url.endswith('.jpg'))
-
     def test_get_bundle_name(self):
         template = self.project.get_bundle_name()
         self.assertEqual(template, 'seq2seq')
@@ -89,10 +77,6 @@ class TestSpeech2textProject(TestCase):
     def setUpTestData(cls):
         cls.project = mommy.make('Speech2textProject')
 
-    def test_image(self):
-        image_url = self.project.image
-        self.assertTrue(image_url.endswith('.jpg'))
-
     def test_get_bundle_name(self):
         template = self.project.get_bundle_name()
         self.assertEqual(template, 'speech2text')