Repository: readthedocs/readthedocs.org

Issue:
Point users to use a configuration file from advanced settings
Currently users may still be using the advanced settings to build their docs, they should use a configuration file, now they can do everything from the web in the config file.

I was thinking in blocking the UI for new projects, but we can't do that, because that would be a problem for people moving to read the docs (they can't modify their docs). A long solution can be allowing to have a global configuration (codecov has this feature), and that can be merged with the configuration of each version (probably I can create another issue to discuss this more if we agree).

Anyway, going back to the original issue:

We already have something like this in the settings

![screenshot_2019-03-06 edit project read the docs](https://user-images.githubusercontent.com/4975310/53922454-651e1400-4042-11e9-88a6-09115ff01a34.png)

I was thinking we could use the same pattern in the advanced settings

![screenshot_2019-03-06 edit advanced project settings read the docs](https://user-images.githubusercontent.com/4975310/53922478-81ba4c00-4042-11e9-91c2-96ddc6eb43c4.png)

But I think that first we should group the settings, we have global and per version settings, so putting the global settings first would be the idea (those are not present in the config file). Then we can list the per-version settings (available in the config file) but first showing a tip/link to the config file docs.

```
Advanced settings

[ ] Single version
[Default branch]
[Default version]
....

:warning: All the next options can be configured using a configuration file.

[Python interpreter]
[ ] Istall project
[Requirements file]
....

```


Discussion:
I think this is a great proposal. I like the idea of separating out global features that can't be configured in the YAML file. I almost wish there was another page to put those 3 settings on but I don't think they belong on the regular settings page.
There are more, I didn't put all p:
There aren't *that* many though.

Resolving patch:
diff --git a/readthedocs/projects/forms.py b/readthedocs/projects/forms.py
--- a/readthedocs/projects/forms.py
+++ b/readthedocs/projects/forms.py
@@ -1,11 +1,10 @@
-# -*- coding: utf-8 -*-
-
 """Project forms."""
-
 from random import choice
 from re import fullmatch
 from urllib.parse import urlparse
 
+from crispy_forms.helper import FormHelper
+from crispy_forms.layout import Fieldset, Layout, HTML
 from django import forms
 from django.conf import settings
 from django.contrib.auth.models import User
@@ -22,7 +21,6 @@
 from readthedocs.oauth.models import RemoteRepository
 from readthedocs.projects import constants
 from readthedocs.projects.exceptions import ProjectSpamError
-from readthedocs.projects.templatetags.projects_tags import sort_version_aware
 from readthedocs.projects.models import (
     Domain,
     EmailHook,
@@ -32,6 +30,7 @@
     ProjectRelationship,
     WebHook,
 )
+from readthedocs.projects.templatetags.projects_tags import sort_version_aware
 from readthedocs.redirects.models import Redirect
 
 
@@ -196,27 +195,18 @@ class ProjectAdvancedForm(ProjectTriggerBuildMixin, ProjectForm):
 
     """Advanced project option form."""
 
-    python_interpreter = forms.ChoiceField(
-        choices=constants.PYTHON_CHOICES,
-        initial='python',
-        help_text=_(
-            'The Python interpreter used to create the virtual '
-            'environment.',
-        ),
-    )
-
     class Meta:
         model = Project
-        fields = (
-            # Global settings.
+        per_project_settings = (
             'default_version',
             'default_branch',
             'privacy_level',
             'analytics_code',
             'show_version_warning',
             'single_version',
-
-            # Options that can be set per-version using a config file.
+        )
+        # These that can be set per-version using a config file.
+        per_version_settings = (
             'documentation_type',
             'requirements_file',
             'python_interpreter',
@@ -226,10 +216,30 @@ class Meta:
             'enable_pdf_build',
             'enable_epub_build',
         )
+        fields = (
+            *per_project_settings,
+            *per_version_settings,
+        )
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 
+        self.helper = FormHelper()
+        help_text = render_to_string(
+            'projects/project_advanced_settings_helptext.html'
+        )
+        self.helper.layout = Layout(
+            Fieldset(
+                _("Global settings"),
+                *self.Meta.per_project_settings,
+            ),
+            Fieldset(
+                _("Default settings"),
+                HTML(help_text),
+                *self.Meta.per_version_settings,
+            ),
+        )
+
         default_choice = (None, '-' * 9)
         all_versions = self.instance.versions.values_list(
             'identifier',
diff --git a/readthedocs/settings/base.py b/readthedocs/settings/base.py
--- a/readthedocs/settings/base.py
+++ b/readthedocs/settings/base.py
@@ -84,6 +84,7 @@ def INSTALLED_APPS(self):  # noqa
             'textclassifier',
             'annoying',
             'django_extensions',
+            'crispy_forms',
             'messages_extends',
             'django_elasticsearch_dsl',
 


Test patch: